I have a JavaScript array of objects like this:
var myArray = [{...}, {...}, {...}];
Each object has unique id among other pro
id
If each id is unique, you can do it like this:
o1 = {id:1} o2 = {id:2} o3 = {id:3} o4 = {id:4} a = [o1,o2,o3,o4] a.indexOf( a.filter( function(i){return i.id==4} )[0] );