How can I use findIndex when I have a array of strings or objects. Both of the above code returns -1
console.log(['kk', 'll', 'mm', 'pp'].findIndex(function(x) { x == 'mm'}))
console.log([{name: 'kk'},{name: 'vv'},{name: 'mm'},{name: 'ok'}].findIndex(function(x) { x.name == 'mm'}))