Have some data:
[
{
property1: 1,
property2: 2,
},
{
property1: 1,
property2: 3,
},
{
property1: 2,
property2: 3,
}
]
I need to get all objects of this array where property1=1
. Is there more easier or shorter way to do this than something like:
for(var i=0;i<array.length;i++){
if(array[i]["property1"]==1) ....//some action
}
Like in jquery I can use selector for DOM elements, if I need to get all span's with property1=1 I use $("span[property1=1]").each....