Array.prototype.findIndexintermediateconst users = [{id:1}, {id:2}, {id:3}]
users.findIndex(u => u.id === 2) // β 1Use findIndex() on an object array to find the position of a specific record.
findIndex() is often used with object arrays to get the index of an object with a specific property value.
Challenge: Implement indexOfId(items, id) that returns the index of the item with matching id.
indexOfId([{id:1},{id:2},{id:3}], 2) // β 1
indexOfId([{id:1},{id:2}], 99) // β -1