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

134
Visualizações
How can I avoid decimals in a number value that is shown with innerHTML

The code is for an audio system when the user presses Up arrow or Down arrow then the volume changing with 0.05 up or down (5%) on the audio volume. That code isn't important. I just said because the changing value is 0.05 that means when I want to display the current volume the numbers sometimes look like this:
A good one:
A bad one:

Anything I could use? Maybe RegEx? (but how) Here is the code:

Element.innerHTML = "Hangerő: <strong>" + (audio_element.volume * 100) + "%</strong>"
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Try parseInt() .

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt

Element.innerHTML = "Hangerő: <strong>" + parseInt(audio_element.volume * 100) + "%</strong>"
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