Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprenda Challenge: Print Numbers from 5 to 9 | Looping Through Data in JavaScript
Introduction to JavaScript

bookChallenge: Print Numbers from 5 to 9

Task

Let's implement a while loop that outputs numbers from 5 to 9 to the console.

123456
let a = 5; ___ (a ___ ___) { console.log(___); ___++; };
copy

The output should be:

5
6
7
8
9
  1. Set the condition to a <= 9 or a < 10.
  2. Include the variable a within the console.log() function.
  3. Increment the value of a inside the loop.
123456
let a = 5; while (a <= 9) { console.log(a); a++; }
copy

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 5. Capítulo 3

Pergunte à IA

expand

Pergunte à IA

ChatGPT

Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo

Suggested prompts:

Can you explain how the while loop works in this example?

What would happen if we changed the starting value of 'a'?

Can you show how to do the same with a for loop?

Awesome!

Completion rate improved to 2.33

bookChallenge: Print Numbers from 5 to 9

Deslize para mostrar o menu

Task

Let's implement a while loop that outputs numbers from 5 to 9 to the console.

123456
let a = 5; ___ (a ___ ___) { console.log(___); ___++; };
copy

The output should be:

5
6
7
8
9
  1. Set the condition to a <= 9 or a < 10.
  2. Include the variable a within the console.log() function.
  3. Increment the value of a inside the loop.
123456
let a = 5; while (a <= 9) { console.log(a); a++; }
copy

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 5. Capítulo 3
some-alt