Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

164
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda