Differences between two operators
I am not clear about the exact differences between == and ===.Please do tell me the difference between them
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Vinitha TPosted Nov 8, 2021, 12:16 PM
Double Equals (==) - It checks with only value of operands. It is type converting conversion, it will convert the operands into same type and then it will compare the values.
Triple Equals (===) - It checks with value of operands and its datatype. It is Strict conversion, it wont perform any conversion when the operands are of different data types.
var a = 1;
var b = 1;
var c = "1";
console.log ( a == b ) ; // return true
console.log ( a === b ) ; // return true
console.log ( a == c ) ; // return true
console.log ( a === c ) ; // return false
Sam HobbsPosted Jan 19, 2012, 3:29 AM
Pravin MorePosted Jan 19, 2012, 12:24 AM
its simple == checks only value whereas === checks valuse as well as Datatype
for e.g:-
1=="1" // is true
but
1==="1" //is false.
Thanks,
Pravin.