title: Search for Matching Properties and Equivalent Property Values
body: <p>I am working on a task for freecodecamp and find myself very stuck. The task is to: </p>
  
  <p>"Make a function that looks through a list (first argument) and returns an array of all objects that have equivalent property values (second argument).</p>
  
  <p>Here are some helpful topics:</p>
  
  <p>Global Object</p>
  
  <p>Object.hasOwnProperty()</p>
  
  <p>Object.keys()"</p>
  
  <p>Here is what I have so far. I was hoping for some guidance and explanation not just a completely different code to copy and paste. Looking to learn and grow. Thank you so much.</p>
  
  <pre><code>function where(collection, source) {
    var arr = [];
  
    var sourceProp = Object.keys(source)[1];
  
    for (i = 0; i&lt;collection.length; i++){
      if (collection[i].hasOwnProperty(sourceProp) &amp;&amp; collection.sourceProp == source.sourceProp){
         arr.push(collection[i]);
      }
    }
    return arr;
  }
  
  where([{ first: 'Romeo', last: 'Montague' }, { first: 'Mercutio', last: null }, { first: 'Tybalt', last: 'Capulet' }], { last: 'Capulet' });
  </code></pre>