16
rated 0 times
[
18]
[
2]
/ answers: 1 / hits: 40676
/ 12 Years ago, sun, september 23, 2012, 12:00:00
I have a JavaScript array of objects like this:
var myArray = [{...}, {...}, {...}];
Each object has unique id
among other properties:
{
id: 4,
property1: 'something',
property2: 'something'
}
How can I get an index of a particular object in that array, if I only know its id
property? So if I know that myArray[x].id == 4
, how can I find x
?
More From » arrays