In an array of objects, fastest way to find the index of an object whose attributes match a search

Maybe you would like to use higher-order functions such as “map”.
Assuming you want search by ‘field’ attribute:

var elementPos = array.map(function(x) {return x.id; }).indexOf(idYourAreLookingFor);
var objectFound = array[elementPos];

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)