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

Kurssisisältö

Introduction to JavaScript

Introduction to JavaScript

1. JavaScript Fundamentals
2. Variables and Data Types in JavaScript
3. Performing Operations in JavaScript
4. Controlling Program Flow with Conditional Statements
5. Looping Through Data in JavaScript
6. Functions in 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.

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

The output should be:

python
  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

Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 5. Luku 3
Pahoittelemme, että jotain meni pieleen. Mitä tapahtui?
some-alt