+ 1
In javascript, why we use (==)?
In javascript, why we use (==)?
2 Answers
+ 1
== or === are to compare two elements (43==21 returns false beacuse 43 is not equal to 21), while the = is to assign a value to a variable.
+ 1
if (youreName == myName) {
alert('COPYRIGHT ! ! !');
}
"42" == 42 // true
"42" === "42" // FALSE
42 === 42 // TRUE