javascript / beginner
Snippet
The Strict Equality Operator (===)
The strict equality operator (===) checks if both the value and the data type of two items are identical.
snippet.js
1
2
3
4
5
6
const input = "5";if (input === 5) {console.log("Match");} else {console.log("No match: Types differ");}
nodejs
Breakdown
1
if (input === 5) {
Checks if the string "5" is strictly equal to the number 5 (this will be false).