I saw interview question here in debugging section (first question).
function greet(person) {
if (person == { name: 'amy' }) {
return 'hey amy'
} else {
return 'hey arnold'
}
}
greet({ name: 'amy' })
This is printing hey arnold
.
I want to understand why this is happening? Any explanation or direction to resource would be much appreciated.