When testing for equality in object literals, {} === {}
returns false (so does [] === []
). However, if you write a function to perform the same test and pass an object literal as a parameter, the comparison returns true.
function foo(value) {
return value === value
}
foo({}) //Returns true!
Is anyone able to explain this behaviour?