title: JavaScript or AngularJS: Find two objects with matching properties values
body: <p>I am sure this question will have be asked before but for some reason i can't find the right way to find the answer I'm after.</p>
  
  <p>I have two lists of objects. The objects are slightly different but both have a 'ref' property that i can compare them with. I basically want a new list of objects that contains only the objects that are in list1 with a ref value that does not equal any of the ref values for objects in list2. </p>
  
  <p>Currently this is the method I use. <strong>This does work</strong>. However I know that this is probably very inefficient since I am using two loops and looping through the second one countless times. So I'm wondering what the 'proper' method of doing this would be.</p>
  
  <pre><code>var add;
  for (var x = 0; x &lt; availableQuestions.length; x++) {
      add = true;
      for (var j = 0; j &lt; currentQuestions.length; j++) {
          if (availableQuestions[x].Ref == currentQuestions[j].Ref) {
              add = false;
          }
      }
      if (add) {
          $scope.Questions.push(availableQuestions[x])
      }
  }
  </code></pre>