(4/10)

Making Choices — JavaScript typing lesson

Use if/else statements to make decisions in your code.

What you'll practice

Let's learn to make choices! The `if/else` statement helps our program decide what to do.

  • `if` checks if a condition in the parentheses () is true.
  • `else` runs if the condition is false.
📜JavaScript

Making Choices

0 WPM
0% Accuracy
0:00 Time elapsed
1
2
3
4
5
6
let coins = 12;↵
if (coins > 10) {↵
console.log('you have enough for the super-ride');↵
} else {↵
console.log('you need more coins for the super-ride');↵
}
0 / 158
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