I have an array of objects like so:
var myArray = [
{field: \'id\', operator: \'eq\', value: id},
{field: \'cStatus\', operator: \'eq\', value: cSta
jAndy's solution is probably best, but if you can't rely on filter you could do something like:
var myArray = [
{field: 'id', operator: 'eq', value: 'id'},
{field: 'cStatus', operator: 'eq', value: 'cStatus'},
{field: 'money', operator: 'eq', value: "money"}
];
myArray.remove_key = function(key){
var i = 0,
keyval = null;
for( ; i < this.length; i++){
if(this[i].field == key){
keyval = this.splice(i, 1);
break;
}
}
return keyval;
}