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

221
Visualizações
What is the differences between these two for loops?

Both of the consolt results are same. Anyone can explain me why it is being like that?

console result

for (let index = 0; index < 5; index++) {
  console.log(index)
}
for (let index = 0; index < 5; ++index) {
  console.log(index)
}
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

First loop use post, and second loop use pre increment. The desc like this ++index (pre-increment) means "increment the variable; the value of the expression is the final value" Index++ (post-increment) means "remember the original value, then increment the variable; the value of the expression is the original value"

Or u can follow this link https://stackoverflow.com/a/3469896/17123841

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