I have two objects which I am comparing. I have an array of objects, and I am trying to see if the array contains a certain object. I think it should be finding it, but it is not. Here is the object in the array:

and here is the object I am looking for:

I am using:
if (collection.indexOf(object) !== -1) {
//do something
}
And it returns an index of -1, even though it seems to me that the objects match. Am I missing something here?
indexOf()will work only for elementary types like numbers, strings, boolean etc. It does not do deep comparison to match objects.