title: Determine if the object has a property and value in javascript
body: <p>I wanted to check if the an object has a property of something and its value is equal to a certain value.</p>
  
  <pre><code>var test = [{name : "joey", age: 15}, {name: "hell", age: 12}]
  </code></pre>
  
  <p>There you go, an array of objects, now I wanted to search inside the object and return true if the object contains what I wanted.</p>
  
  <p>I tried to do it like this:</p>
  
  <pre><code>Object.prototype.inObject = function(key, value) {
  if (this.hasOwnProperty(key) &amp;&amp; this[key] === value) {
    return true
  };
  return false;
  };
  </code></pre>
  
  <p>This works, but not in an array. How do I do that?</p>