← All Posts
Blog
June 14, 2021

Find index object array in Javascript with Lodash

Find index object array in Javascript with Lodash javascript Library

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