Skip to content
dreamcode
dreamcode
Map
Comparisons
Lesson 6 of 48
+15 XP on finish
JAVASCRIPT CLIMBSChapter 2 · JS Conditionals & Logic

Strict Equality

JavaScript uses === (strict equality) and !== (strict inequality) to compare both the value and the type. Avoid ==, which can coerce types and cause hidden bugs.

Worked example

How it reads

  • altitude > 500 compares numbers, returning true
  • === checks if value and type are identical, returning false here
Cloud tip: Always use strict equality ===. Using double equals == invites unexpected type conversion behavior.
index.js
JAVASCRIPT
real JavaScript, runs in your browser
Console
Run your code to see its output here.
YOUR TURN

Log whether stars is exactly "50" (the text) using strict equality, then whether it equals the number 50. The output should end with false and true.

Press Run to check your work.