Finds the index of an object in an array that contains a specific key-value pair.
- Version
- 2.0.0
Example
// Example usage:
const data = [
{ id: 1, name: 'John' },
{ id: 2, name: 'Jane' },
{ id: 3, name: 'Joe' }
];
const resultIndex = findIndex(data, 'name', 'Jane');
console.log(resultIndex); // 1