Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

221
Visualizações
JavaScript point counter for a html snake like game

I'm new to learning JavaScript, I’ve searched many websites, and cannot find a solution so far.

I am making a mini-game on a base of snake, Can anybody help me make a point counter using javascript and html,

You can check out the game here!

https://github.com/LiquidSlime/Worm-game

and i would like to have it done using

<div id="points"<h1></h1></div>
and javascript;
var element = document.getElementById("points")
**Code here**;

hopefully someone can help me out!

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can make a span with the id points

<span id=points>? Points</span>

Then in js change the innnerText

const pointElement = document.getElementById('points')

function updatePoints(points) {
  pointElement.innerText = points + ' Points'
}

Then run the update points

updatePoints(1)

// If you want to load if from another varible

// get points from somewhere else

updatePoints(points)

When you want it to update something would be like this in your code

points++;
updatePoints(points)
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda