Comparison Operators, online

Six activities your students do on their own devices. See who's finished, and their scores.

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

Discover other journeys with this module

What students will learn in this module

Every question in Module 11

Quick questions

  1. Does === check if two values are equal in both value and type?AYesBNo
  2. Does !== check if two values are not strictly equal?ANoBYes
  3. Is = a valid way to check if two values are equal?ANoBYes
  4. Does > check if the left value is greater than the right?AYesBNo
  5. 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 does
5 !== 3Match it to what it does
Compares if one value is greater than anotherMatch it to what it does
Compares if one value is less than anotherMatch it to what it does
console.log(5 = 5);Match it to what it does
console.log(5 !=== 3);Match it to what it does

Fill in the blanks

  1. console.log(5 ___ 5);

    Hint: Type the operator that checks strict equality.

  2. console.log(5 ___ 3);

    Hint: Type the operator that checks strict inequality.

  3. console.log(10 _ 7);

    Hint: Type the operator that checks if one value is greater.

  4. console.log(3 _ 8);

    Hint: Type the operator that checks if one value is less.

  5. 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;