Question: I confuse the operator explain description below: Is that correct?
var length = "50";
if (length === 50) {...} // It allows for a block of code to fire if the length equals 50 regardless of the data type.
Thanks,
Question: I confuse the operator explain description below: Is that correct?
var length = "50";
if (length === 50) {...} // It allows for a block of code to fire if the length equals 50 regardless of the data type.
Thanks,
== checks if the 2 values are the same.
=== checks if the 2 values are the same and are of the same type.
a == b means check if a is equal to b, and don't worry about what types they are
a === b means check if a is exactly, type and all, equal to b