title: Using jQuery inArray with array of JavaScript Objects
body: <p>I'm working with an array of JavaScript Objects as such:</p>
  
  <pre><code>var IssuesArray = [{"ID" : "1", "Name" : "Issue1"}, 
                     {"ID" : "2", "Name" : "Issue2"}, 
                     {"ID" : "3", "Name" : "Issue3"}];
  </code></pre>
  
  <p>My end effort is trying to remove an object from the array when I know the ID of the object. I'm trying to use code that is something like this:</p>
  
  <pre><code>$.grep(IssuesArray, function(n, i) {
      return i != $.inArray("2", IssuesArray);
  });
  </code></pre>
  
  <p>So this shows that I'm trying to use jQuery grep to remove an element by index (i), which I am trying to retrieve by using jQuery inArray. Of course the code above will not work because "2" should correspond to an item in the array, which are all JavaScript objects (an object will never equal "2"). I need something like: </p>
  
  <pre><code>$.inArray(javascriptObject.Name=="2", IssuesArray);
  </code></pre>
  
  <p>Has anyone ever had any success using inArray to get indexes of JavaScript objects, using a field value within that object? Any help would be appreciated. Thanks.</p>
  
  <p><strong>UPDATE/CLARIFICATION:</strong> A couple people have been confused by my question, but I received an answer that works nonetheless. I'm using:</p>
  
  <pre><code>IssuesArray = $.grep(IssuesArray, function(n) {
      return n.ID != "2";
  });
  </code></pre>
  
  <p>I think I was thinking about it too deep, when the solution was really pretty easy. I simply wanted to remove a JavaScript object from an array, so long as I knew a particular property's value in that object. The above solution uses jQuery's grep to return everything from the array except any object whose ID == "2". As usual, thanks for the quick answers. A couple answers were good solutions and would have worked using (using "splice", for example), but this solution seems to be the shortest most straightforward. Thanks again.</p>