Truthy and Falsy Values

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Truthy and Falsy Values

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Is 0 a falsy value?
A Yes
B No
2. Is an empty string "" falsy?
A No
B Yes
3. Is the string "0" truthy?
A Yes
B No
4. Is an empty array [] falsy?
A No
B Yes
5. Is NaN a falsy value?
A No
B Yes

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
10 AWrong - the string "0" is actually truthy
2"hello" B""
3The empty string, always falsy CWrong - an empty array is actually truthy
4An empty array, actually truthy DA falsy value - treated as false in a boolean context
5"0" is treated as falsy in an if statement EA truthy value - treated as true in a boolean context
6[] is treated as falsy in an if statement F[]

Definitions

Falsy

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
0 is a _____ value
2.
"" is a _____ value
3.
1 is a ______ value
4.
An empty string is a _____ value
5.
An array [] is a ______ value

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A "" is truthy
B 0 is falsy
C 1 is truthy
Question 2
A null is falsy
B "0" is falsy
C NaN is falsy
Question 3
A false is falsy
B undefined is falsy
C [] is falsy
D {} is truthy
Question 4
A true is truthy
B 1 is truthy
C -1 is truthy
D 0 is truthy
Question 5
A false is falsy
B 0 is falsy
C "" is falsy
D null is falsy
E 1 is falsy

Answer Key

Truthy and Falsy Values
Section A: Quick Questions
Q1
A — Yes
Q2
B — Yes
Q3
A — Yes
Q4
A — No
Q5
B — Yes
Section B: Match the Pairs
Q1
0 → A falsy value - treated as false in a boolean context
Q2
"hello" → A truthy value - treated as true in a boolean context
Q3
The empty string, always falsy → ""
Q4
An empty array, actually truthy → []
Q5
"0" is treated as falsy in an if statement → Wrong - the string "0" is actually truthy
Q6
[] is treated as falsy in an if statement → Wrong - an empty array is actually truthy
Section C: Definitions
Q1
Falsy — A value that JavaScript treats as false in a boolean context, such as 0, "", null, undefined, or NaN.
Section D: Fill in the Blanks
Q1
0 is a falsy value
Q2
"" is a falsy value
Q3
1 is a truthy value
Q4
An empty string is a falsy value
Q5
An array [] is a truthy value
Section E: Spot the Error
Q1
A — An empty string is falsy, not truthy.
Q2
B — The string "0" is actually truthy - it's not empty.
Q3
C — An empty array is truthy, not falsy.
Q4
D — 0 is falsy, not truthy.
Q5
E — 1 is truthy, not falsy.