Use of === operator in Javascript

gosh

New member
Joined
Jun 13, 2024
Messages
3
Points
1
The === operator is used in JavaScript to compare the values of two operands. It checks if the operands have the same value and also checks if they have the same type. This is known as strict equality, and it is different from the == operator, which only checks for value equality and does not check for type.
The = is simply an assignment to a variable.
 

Cloyd

New member
Joined
Jun 13, 2024
Messages
3
Points
1
to avoid type casting use strict comparison ====
otherwise string like '2' will be transformed into 2 when you are comparing 2 and '2' with ==
Also you can face some other bugs with that
I see no reason to use ==
 
Top