My array looks like this:
array = [object {id: 1, value: \"itemname\"}, object {id: 2, value: \"itemname\"}, ...]
all my objects have the s
You'll have to loop over the array, but if you make a hashmap to link each id to an index and save that, you only have to do it once, so you can reference any objeft after that directly:
var idReference = myArray.reduce(function( map, record, index ) {
map[ record.id ] = index;
return map;
}, {});
var objectWithId5 = myArray[ idReference["5"] ];
This does assume all ids are unique though.