194
rated 0 times
[
197]
[
3]
/ answers: 1 / hits: 27556
/ 12 Years ago, thu, march 15, 2012, 12:00:00
I have the following json object that im iterating through:
obj = { '19': { id: '19', price: 5.55},
'20': { id: '20', price: 10.00} }
$.each(obj, function(index, value){
if(value.price < 5)
{
delete obj[index];
}
});
I just want to delete an item from the object under certain conditions. In this case, if the price is less than 5.
I've tried delete, but it doesn't do anything.
More From » jquery