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

book
Challenge: Print Numbers from 5 to 9

Task

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

let a = 5;

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

The output should be:

python
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.

let a = 5;

while (a <= 9) {
console.log(a);
a++;
}
123456
let a = 5; while (a <= 9) { console.log(a); a++; }
copy

¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 5. Capítulo 3

Pregunte a AI

expand
ChatGPT

Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla

We use cookies to make your experience better!
some-alt