-1

I mean not equal, but literally one....two things pointing to the same place in memory.

For example, a and b here should theoretically be identical...b is a sort of pointer to a.

var a = function(){alert("hi");}

var b = a;

=== is not the answer....two things can be the same in every way but not literally the same object in memory.

Edit: === IS the answer! Silly me.

temporary_user_name
  • 35,956
  • 47
  • 141
  • 220

2 Answers2

2

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators

An expression comparing Objects is only true if the operands reference the same Object.

matthewk
  • 1,841
  • 17
  • 31
  • Oh...and that is the piece I did not know about the `===` operator...turns out it IS the answer! – temporary_user_name Feb 08 '14 at 23:35
  • 1
    Because the code example is exactly what I needed to see to be sure! Hard code is much more persuasive than documentation, although together the two answers are 100% complete. If you're on SO for the rep, btw, you need a hobby. – temporary_user_name Feb 08 '14 at 23:37
1

Two identical objects never return true when compared. They really have to be "one".

Preview

ElDoRado1239
  • 3,938
  • 2
  • 16
  • 13