(3/10)

Looping With A Condition (While Loops) — JavaScript typing lesson

Practice while loops for conditional repetition.

What you'll practice

A `while` loop keeps running as long as its condition is true. It's great for when you don't know how many times to loop.

  • The loop continues as long as `count > 0` is true.
  • Inside the loop, we must change the `count` variable so the loop can eventually end.

Pro Access Required

This is a premium lesson. Upgrade to Pro to unlock this interactive exercise and continue your learning journey.

📜JavaScript

Looping With A Condition (While Loops)

0 WPM
0% Accuracy
0:00 Time elapsed
1
2
3
4
5
6
7
let count = 5;↵
while (count > 0) {↵
console.log(count);↵
count = count - 1;↵
}↵
↵
console.log('blast off');
0 / 110
Press This!
👇
`~
1!
2@
3#
4$
5%
6^
7&
8*
9(
0)
-_
=+
⌫
⇥
Q
W
E
R
T
Y
U
I
O
P
[{
]}
\|
⇪
A
S
D
F
G
H
J
K
L
;:
'"
↵
⇧
Z
X
C
V
B
N
M
,<
.>
/?
⇧
Thumb
Index
Middle
Ring
Pinky