Find index object array in Javascript with Lodash

Thumbnail image

Install Lodash using NPM or CDN

if you are using ES6 feature, please use :

import _ from 'lodash'

let array = [
  { name: 'John',age:20},
  {name: 'Anna', age: 23},
  {name: 'Paul',age: 25}
];

let findIndex = _.findIndex(array,{name:'Anna'});
//console.log(findIndex) == 1