what is difference identical(===) and equal to (==) operator in JavaScript? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

what is difference identical(===) and equal to (==) operator in JavaScript?

please explain in detail what is difference identical(===) and equal to (==) operator in JavaScript. why identical (===) operator is also called as strictly equal to operator?

10th Jul 2018, 11:33 AM
Suraj Jha
Suraj Jha - avatar
5 Answers
+ 10
The 3 equals sign (===) mean "strict equality". Unlike double equals (==), the values must be equal in type too. For example: 1 == "1" // true 1 === "1" // false 0 == false // true 0 === false // false false == "0" // true false === "0" // true null == undefined // true null === undefined // false I hope that helps. :)
10th Jul 2018, 12:06 PM
Harsh
Harsh - avatar
+ 3
thank you Stellar Fox
10th Jul 2018, 12:09 PM
Suraj Jha
Suraj Jha - avatar
+ 2
The == operator will compare for equality after doing any necessary type conversions. The === operator will not do type conversion. ex: "1" == 1 // true Here because of type conversion (the actual term is "implicit type coercion"), the values will be converted to the same type before being compared so "1" which is a string will be converted to the number 1. Now that both are the same type, their values are compared and as they are the same, the result will be true. "1" === 1 // false However, there is no implicit type coercion when you use the strictly sign operator. https://medium.freecodecamp.org/js-type-coercion-explained-27ba3d9a2839
31st Mar 2019, 7:49 AM
codeKameleon
codeKameleon - avatar
+ 1
(==) means the left is equal to the right but (===) means the left is equal to the right and also in type.
19th Jul 2018, 2:21 PM
Glow❤✨
Glow❤✨ - avatar
0
Pls explain
9th Nov 2018, 4:49 PM
Aatas AG