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

123
Vistas
Print a Given Number in Reverse

My instructor gave this code that works well and, for where we are at this point in the course, this is the code he expects us to use. I understand 90% of this, but not fully sure why combining %10, math.trunc, and then multiplying by 10 will give me the reverse number. I really hope there is someone here that can explain it in simple terms for me to understand. Thank you!!

let num = +prompt("enter number");
let reversedNum = 0;
while (num !=0){
    let rightMostDigit = num %10;
    num = Math.trunc(num / 10);
    reversedNum = reversedNum*10 + rightMostDigit;
}

document.write(reversedNum)

about 4 years ago · Juan Pablo Isaza
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