Javascript: How to remove an array item(JSON object) based on the item property value?
<p>like this:  </p>

<pre><code>var arr = [  
            { name: "robin", age: 19 },   
            { name: "tom", age: 29 },  
            { name: "test", age: 39 } 
          ];
</code></pre>

<p>I want to remove array item like this(an array prototype method):</p>

<pre><code>arr.remove("name", "test");  // remove by name  
arr.remove("age", "29");  // remove by age
</code></pre>

<p>currently, I do it by this method(use jQuery):</p>

<pre><code>Array.prototype.remove = function(name, value) {  
    array = this;  
    var rest = $.grep(this, function(item){    
        return (item[name] != value);    
    });  

    array.length = rest.length;  
    $.each(rest, function(n, obj) {  
        array[n] = obj;  
    });  
};
</code></pre>

<p>but I think the solution has some performance issue,so any good idea?  </p>
