title: push only unique elements in an array
body: <p>I have array object(x) that stores json (key,value) objects. I need to make sure that x only takes json object with unique key. Below, example 'id' is the key, so i don't want to store other json objects with 'item1' key.</p>
  
  <pre><code>x = [{"id":"item1","val":"Items"},{"id":"item1","val":"Items"},{"id":"item1","val":"Items"}]    
  
  var clickId = // could be "item1", "item2"....
  var found = $.inArray(clickId, x);  //
  if(found &gt;=0)
  {
      x.splice(found,1);
  }
  else{
      x.push(new Item(clickId, obj)); //push json object
  }
  </code></pre>