0

What is the difference between == and ===?

1st Jul 2016, 9:25 AM
Anu Ninan
Anu Ninan - avatar
4 Answers
+ 2
=== means that the two values have to be indentical to, including of data type whereas == just means that they have to be the same value regardless of data type
7th Jul 2016, 10:44 AM
Chris Wilson
0
Example to help understand 1 === 1: true 1 == 1: true 1 === "1": false // 1 is an integer, "1" is a string 1 == "1": true // "1" gets casted to an integer, which is 1 "foo" === "foo": true // both operands are strings and have the same value
4th Jul 2016, 4:34 AM
Kelvin Jardin
Kelvin Jardin - avatar
0
this means this operator can be used to get if both are same data type or not?
4th Jul 2016, 12:01 PM
Prashant
0
this operator evaluates two things first whether the given values are equal or not thn it evaluates their data types if both are true then result is true ..
4th Jul 2016, 2:23 PM
Ashutosh Pandey
Ashutosh Pandey - avatar