let database = [{
name: 'James Bond',
code: '007'
},
{
name: 'El',
code: '11'
}
]
let subject = {
name: 'James Bond',
code: '007'
}
database.indexOf(subject)
This returns -1. I found similar questions here on SO but they were all mostly asking to find index of the object by comparing it to a key value pair.