title: Setting the values of an array depending on the values in a separate array [Angular, forEach]
body: <p>I have two sets of arrays, <code>$scope.Skills</code> and <code>$scope.skillslist</code>. </p>
  
  <p>The <code>Skills</code> array has a ton of values, so I'm only including the ones relevant to the question:</p>
  
  <pre><code>$scope.Skills = [
      {LotsOfValues: "blah", Skill_Values__c: "1"},
      {LotsOfValues: "blah", Skill_Values__c: "2"},
      {LotsOfValues: "blah", Skill_Values__c: "3"}
  ];
  </code></pre>
  
  <p>And the <code>skillslist</code> array:</p>
  
  <pre><code>$scope.skillslist = [
      {Skill_Values__c: "1", Checked: ""},
      {Skill_Values__c: "2", Checked: ""},
      {Skill_Values__c: "3", Checked: ""},
      {Skill_Values__c: "4", Checked: ""},
      {Skill_Values__c: "5", Checked: ""},
      {Skill_Values__c: "6", Checked: ""},
      {Skill_Values__c: "7", Checked: ""}
  ];
  </code></pre>
  
  <p>What I want to do is, for each item in the <code>skillslist</code>, run it against the items in <code>Skills</code>, and if there's a match, set Checked to true, if not set it to false. How can this be accomplished?</p>
  
  <p>I'm using the forEach function and this is what I have so far:</p>
  
  <pre><code>angular.forEach(skills, function (value) {
      console.log("FOR EACH");
      for (var i = 0; i &lt;= $scope.skillslist.length; i++) {
          if ($scope.skillslist[i].Skill_Values__c === value.Skill_Values__c) {
              $scope.skillslist[i].Checked = "Added";
          } else {
              $scope.skillslist[i].Checked = "no";
          }
      }
  });
  </code></pre>
  
  <p>But straight away I know I'm doing it wrong because I should be looking forEach <code>skillslist</code> right? But when I do that I have no idea how to then change the Checked value for each one. Swapping all <code>Skills</code> for <code>skillslist</code> didn't help.</p>
  
  <p>In my ng-repeat of <code>skillslist</code>, I see the first item has a Checked value of "Added", the rest have a Checked value of "no".</p>
  
  <p>I've been reading through forEach examples, but couldn't find any related to what I'm trying to do, about referencing two different arrays in this way. Any pointers would be appreciated!</p>