Truthy and Falsy Values, online
Six activities your students do on their own devices. See who's finished, and their scores.
Learning
Understanding
Testing
Truthy and Falsy Values in one minute
What students need to know
An empty string is one of the falsy values. Unlike an empty string, an empty array is truthy.
0 is treated as false in a boolean context. NaN is one of JavaScript's falsy values.
Mistakes students make
- An empty string is falsy, not truthy.
- The string "0" is actually truthy - it's not empty.
- An empty array is truthy, not falsy.
- 0 is falsy, not truthy.
PREVIOUS · MODULE 12Boolean Logic
YOU ARE HERE · MODULE 13Truthy and Falsy Values
NEXT · MODULE 14If Statements
What students will learn in this module
Every question in Module 13
Quick questions
- Is 0 a falsy value?AYesBNo
- Is an empty string "" falsy?ANoBYes
- Is the string "0" truthy?AYesBNo
- Is an empty array [] falsy?ANoBYes
- Is NaN a falsy value?ANoBYes
Key terms
Students type the meaning of:
Falsy
Match the pairs
0Match it to what it does"hello"Match it to what it doesThe empty string, always falsyMatch it to what it doesAn empty array, actually truthyMatch it to what it does"0" is treated as falsy in an if statementMatch it to what it does[] is treated as falsy in an if statementMatch it to what it doesFill in the blanks
0 is a _____ value
Hint: Type the word for a value treated as false in a boolean context.
"" is a _____ value
Hint: Type the word for a value treated as false in a boolean context.
1 is a ______ value
Hint: Type the word for a value treated as true in a boolean context.
An empty string is a _____ value
Hint: Type the word for a value treated as false in a boolean context.
An array [] is a ______ value
Hint: Type the word for a value treated as true in a boolean context.
Spot the error
Question 1
A"" is truthyB0 is falsyC1 is truthy
Question 2
Anull is falsyB"0" is falsyCNaN is falsy
Question 3
Afalse is falsyBundefined is falsyC[] is falsyD{} is truthy
Question 4
Atrue is truthyB1 is truthyC-1 is truthyD0 is truthy
Question 5
Afalse is falsyB0 is falsyC"" is falsyDnull is falsyE1 is falsy
