Findindex() Javascript Array Object
var array = [{'one':1, 'two':2},{'one':3, 'two':4}]; var result = array.findIndex(function (value) { if (value === 2) { return fal
Solution 1:
You need to check one of the properties of the objects of the array. Then return the result of the check.
var array = [{ one: 1, two: 2 }, { one: 3, two: 4 }],
result = array.findIndex(function(object) {
return object.two === 2;
});
console.log(result);
Post a Comment for "Findindex() Javascript Array Object"