var x = function() {};
var y = function() {};
alert(x === y); // is false;
Why is x not equal to y if they are both initialised to the same value?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
From MDN:
Clearly, your objects are distinct from each other, and refer to different memory locations. The equals comparison operator checks if both operands refer to the same object, not if they are are replicas.
Consider the fact that
(new Number(1)) != (new Number(1)), whereas1 == 1