I'm new to Java Script
What is the exact difference between (==
Vs ===
, !=
Vs !==
, etc) in JavaScript?
Have read some articles and wanted to be more clear on this.
Thanks in advance.
Asked
Active
Viewed 328 times
0
-
https://www.youtube.com/watch?v=O24XMM1PTqQ – Lauri Elias Apr 14 '14 at 21:14
-
if a function returns multiple values that are equivalent to false like 0, '0' or false (for example 0 means no result and false and error) and you want them to be treated the same then you can use == but if you want them to be treated differently then you have to use ===. – My1 Nov 13 '15 at 10:39
1 Answers
3
The ==
operator means equality after type conversion
1 == '1'; // true
1 == 1; // true
The ===
operator means equality without any conversion
1 === '1'; // false
1 === 1; // true
-
-
!= and !== do the same thing but consider inequality of values converted and of types. – Zini Apr 14 '14 at 21:11