Both methods worked perfectly. Thank you.
On Apr 27, 12:21 pm, mkmanning wrote:
> Not sure why $.grep didn't work for you. Here's a functioning sample
> to compare:
>
> arr = $.grep(arr,function(n,i){
> return n.a1 != 1;
>
> })
>
> On Apr 27, 7:51 am, Mervyn wrote:
>
>
>
> > Hello all,
Not sure why $.grep didn't work for you. Here's a functioning sample
to compare:
arr = $.grep(arr,function(n,i){
return n.a1 != 1;
})
On Apr 27, 7:51 am, Mervyn wrote:
> Hello all,
>
> I have a question about removing an item from an array.
>
> I am looking to remove an item from the ar
Hey Mervyn,
this should do it:
var arr = [{a1: 1, a2: 2},{a1: 3, a2: 4}, {a1: 5, a2: 6}];
for (var i=0; i < arr.length; i++) {
if (arr[i].a1 == 1) {
arr.splice(i,1);
}
}
just loop through the members of the array and check each one's a1
property. If it equals 1, remove it from the
3 matches
Mail list logo