I am using java script to compare values
if (cellValue == "true" || cellValue == true)
Instead of doing this can i use the ===operator in java script ?
I am using java script to compare values
if (cellValue == "true" || cellValue == true)
Instead of doing this can i use the ===operator in java script ?
The difference between ==
and ===
is that the first one (double equals) does type coercion, which can lead to goofy results:
0 == false
true
0 === false
false
It is usually recommended to use ===
as that will provide more predictable results and evaluate the true types of the values you're comparing.