const arr = [
{
key: 'a',
value: 1
},
{
key: "b",
value: 2
},
]
console.log(arr[0].key) // ok
console.log(arr[1].key) // ok
console.log(arr[arr.indexOf(arr.key == 'a')]) // undefined
console.log(arr.indexOf('a')) // -1
console.log(arr.indexOf(a => a.key == 'a')) // -1