← JavaScript

Comparison Operators

Checks if two values are equal in both value and type, returning true or false.

Understanding Comparison Operators in JavaScript

What it does: 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. Comparisons always produce a boolean result. The correct operator is <=, not =<. !== checks that the values or types are different. A single = assigns a value; it doesn't compare values.

Common mistakes: Use === for comparison, not =, which is for assignment. The strict inequality operator is !==, not !===.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 11–25) and word search (Modules 1–29).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Does === check if two values are equal in both value and type?
YesNo
Matches
console.log(5 = 5);
↓
Wrong - use === for comparison, = is for assignment
Applying
Meanings
Term
===
Meaning
Checks if two values are equal in both value and type, returning true or false.
Practice
console.log(5 === 5);
Testing
Gaps
console.log(5 5);
Check Answer
Spots
1console.log(5 = 5);
2console.log(5 === 5);

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Blue-Ringed Octopus' badge — Reef Legend, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Does === check if two values are equal in both value and type?
A. Yes ✓
B. No
=== performs a strict equality check on both value and type.
2. Does !== check if two values are not strictly equal?
A. No
B. Yes ✓
!== returns true when the values or types differ.
3. Is = a valid way to check if two values are equal?
A. No ✓
B. Yes
= is for assignment, not comparison - use === instead.
4. Does > check if the left value is greater than the right?
A. Yes ✓
B. No
> compares two values and returns true if the left is bigger.
5. Does < check if the left value is smaller than the right?
A. No
B. Yes ✓
< compares two values and returns true if the left is smaller.

Match the Pairs

5 === 5 → Returns true because both values and types match
5 !== 3 → Returns true because the values are not equal
Compares if one value is greater than another → 10 > 7
Compares if one value is less than another → 3 < 8
console.log(5 = 5); → Wrong - use === for comparison, = is for assignment
console.log(5 !=== 3); → Wrong - the strict inequality operator is !==, not !===

Key Term

===
Checks if two values are equal in both value and type, returning true or false.

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
A console.log(5 = 5);
B console.log(5 === 5);
C console.log(5 !== 3);
Line A — Use === for comparison, not =, which is for assignment.
Question 2
A console.log(5 !== 3);
B console.log(5 !=== 3);
C console.log(10 > 7);
Line B — The strict inequality operator is !==, not !===.
Question 3
A console.log(10 =< 7);
B console.log(10 > 7);
C console.log(3 < 8);
Line A — Use <= not =<, to check less than or equal.
Question 4
A let a = 5 === 5;
B let b = 5 => 3;
C let c = 3 < 8;
Line B — => is not a comparison operator - use >= for this check.
Question 5
A let x = 5 === 5;
B let y = 5 !== 3;
C let z = age == 12;
D let w = 10 > 7;
Line C — This module uses ===, not the loose ==, for equality checks.

Student with a class code? Join your class →