If I have this code:
var foo1 = new Foo();
var foo2 = new Foo();
and I want to do this:
function updateFoo1 (foo)
{
if (foo === foo1) //If foo is foo1
{
//code for processing
return true;
}
else //Foo must be foo2 or another instance of foo not foo1
return false;
}
Will this work as expected to make sure whether the function argument foo is the same as foo1 and not foo2 or any other instance of the foo class? If not, what should I do to get the result I want?