I am going through a professional book in JavaScript and came to an example of indexOf that confuses me. Please see below.
var person = {name: "Ali"};
var people = [{name: "Ali"}];
var morePeople = [person];
alert(people.indexOf(person)); //returns -1
alert(morePeople.indexOf(people)); //returns 0
I am wondering why the first alert returns -1,because people contains the name Ali. I am confused!