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

161
Visualizações
Can someone correct my understanding of how do-while-loop work

I hope everyone is doing well

I am going to share my understanding of how do-while loop work and i need YOU guys to tell am i,right or not?

Here is the code first:

let k= 1

do{
    if(k===9){
        k++;
        continue;
    }
    console.log(k+1);
    k= k+1;
}while(k<15);

So what this code does is it takes k=1 and in console.log(k+1) , it prints k = 2. And then 1 is added to K original value of 1 and it checks whether the condition is true or not.

If its true, then it will move forward to make another loop and check it.

And when k value reaches to 9, the IF condition becomes true and k++ adds 1 to 9 which is equal to 10 and before printing 10, continue statement terminate that loop and start another loop.

This is what i understood on how it works.

Thanks

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