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

127
Visualizações
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 à 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