+ 3

What is the difference between == and === operator in javascript

Javascript ===

3rd Jun 2017, 9:30 PM
Özer Aydın
Özer Aydın - avatar
7 odpowiedzi
+ 5
Both == and === compare two values for equality. The only difference is that === also compares the type of the two values. For eg: 1 == "1" returns true because JavaScript does automatic type conversion. However this might not be useful in most cases. 1 === "1" returns false, as expected, since a string cannot equal an integer. So you probably should use === unless you have a good reason for using ==
4th Jun 2017, 5:34 AM
Nihar Raote
Nihar Raote - avatar
+ 26
== is equal to === is equal value and equal type
3rd Jun 2017, 11:09 PM
NimWing Yuan
NimWing Yuan - avatar
+ 3
@mr.nobody No problem. I'm glad I could help☺. I wouldn't say I'm talented at all, I just keep practicing. Do the same and you'll get much better at programming 👍.
5th Jun 2017, 1:28 AM
Nihar Raote
Nihar Raote - avatar
+ 2
The operator == compares to equality, but === - to identity.
3rd Jun 2017, 9:50 PM
Mr. Nobody
Mr. Nobody - avatar
+ 1
Nihar Raote, your explain is very understandable and nice, it's must be talent to explain like this. thanks :-)
4th Jun 2017, 10:34 PM
Mr. Nobody
Mr. Nobody - avatar
+ 1
good advice thanx
5th Jun 2017, 2:03 PM
Ahmed Abofteem
Ahmed Abofteem - avatar
0
Very good question. Thanks
5th Nov 2017, 10:36 PM
Hakan Özer
Hakan Özer - avatar