+ 1

In javascript, why we use (==)?

In javascript, why we use (==)?

21st Sep 2016, 5:22 PM
Infoore
Infoore - avatar
2 ответов
+ 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.
22nd Sep 2016, 12:20 AM
Ivan Guiter
Ivan Guiter - avatar
+ 1
if (youreName == myName) { alert('COPYRIGHT ! ! !'); } "42" == 42 // true "42" === "42" // FALSE 42 === 42 // TRUE
12th Nov 2016, 11:37 PM
Pytness
Pytness - avatar