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

165
Visualizações
one rep max calculator

rep max calculator and I'm having a bit of an error with my calculation.

the formula for calculation is (((weight*reps)*0.0333)+weight)

const submit = document.querySelector('.submit');
let weight = document.querySelector('#weight');
let reps = document.querySelector('#reps');

submit.addEventListener('click', function() {
  result = (((weight.value * reps.value) * 0.0333) + weight.value);
  console.log(result);
})
<div class="cardbody">
  <label for="weight"> Lift:</label>
  <input class="input" id="weight" type="text" name="weight" placeholder="weight" required>
  <label for="reps"> Reps:</label>
  <input class="input" id="reps" type="text" name="Reps" placeholder="Repitions" required>
</div>

<div class="cardsubmit">
  <button class="submit">Submit</button>
</div>

now I tried to manually enter my variables so in the javascript made the weight=165 and reps=6 the output that I'm expecting is 197.96 and what I'm getting is 32.967, what I noticed is that my program is not adding the weight at the end.(((weight*reps)*0.0333)+{{weight}}) << I put in double brackets

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

0

The problem here is that weight.value is a string

You need to convertIt to number to add it correctly I've used +weight.value but you can use parseInt instead

const submit = document.querySelector('.submit');
let weight= document.querySelector('#weight');
let reps= document.querySelector('#reps');



submit.addEventListener('click', function(){
    result = +weight.value +(((weight.value * reps.value)*0.0333));
    console.log(result);
})
<div class="cardbody">
    
        <label for="weight"> Lift:</label>
        <input class="input" id="weight" type="text" name="weight" placeholder="weight" required>
        <label for="reps"> Reps:</label>
           
        <input class="input" id="reps" type="text" name="Reps" placeholder="Repitions" required>
        </div>
        
        <div class="cardsubmit">
        
       <button class="submit">Submit</button>
    

</div>

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