Comparison Operators, online
Six activities your students do on their own devices. See who's finished, and their scores.
Learning
Understanding
Testing
Comparison Operators in one minute
What students need to know
This checks whether 10 is greater than 7. === performs a strict equality check on both value and type.
!== returns true when the values or types differ. = is for assignment, not comparison - use === instead.
Mistakes students make
- Use === for comparison, not =, which is for assignment.
- The strict inequality operator is !==, not !===.
- Use <= not =<, to check less than or equal.
- => is not a comparison operator - use >= for this check.
PREVIOUS · MODULE 10Type Conversion
YOU ARE HERE · MODULE 11Comparison Operators
NEXT · MODULE 12Boolean Logic
What students will learn in this module
Every question in Module 11
Quick questions
- Does === check if two values are equal in both value and type?AYesBNo
- Does !== check if two values are not strictly equal?ANoBYes
- Is = a valid way to check if two values are equal?ANoBYes
- Does > check if the left value is greater than the right?AYesBNo
- Does < check if the left value is smaller than the right?ANoBYes
Key terms
Students type the meaning of:
===
Match the pairs
5 === 5Match it to what it does5 !== 3Match it to what it doesCompares if one value is greater than anotherMatch it to what it doesCompares if one value is less than anotherMatch it to what it doesconsole.log(5 = 5);Match it to what it doesconsole.log(5 !=== 3);Match it to what it doesFill in the blanks
console.log(5 ___ 5);
Hint: Type the operator that checks strict equality.
console.log(5 ___ 3);
Hint: Type the operator that checks strict inequality.
console.log(10 _ 7);
Hint: Type the operator that checks if one value is greater.
console.log(3 _ 8);
Hint: Type the operator that checks if one value is less.
let isEqual = age ___ 12;
Hint: Type the operator that checks strict equality.
Spot the error
Question 1
Aconsole.log(5 = 5);Bconsole.log(5 === 5);Cconsole.log(5 !== 3);
Question 2
Aconsole.log(5 !== 3);Bconsole.log(5 !=== 3);Cconsole.log(10 > 7);
Question 3
Aconsole.log(10 =< 7);Bconsole.log(10 > 7);Cconsole.log(3 < 8);
Question 4
Alet a = 5 === 5;Blet b = 5 => 3;Clet c = 3 < 8;
Question 5
Alet x = 5 === 5;Blet y = 5 !== 3;Clet z = age == 12;Dlet w = 10 > 7;
