title: Javascript check if string exists in array of objects
body: <p>I have two arrays in my program, one contains a list of strings that act as keys, the other contains objects that contain a key as well.</p>
  
  <pre><code>let classKeys = ['math', 'robotics'];
  let classesInList = [{key : "WIHUGDYVWJ", className : 'math'},{key : "qwljdhkuqwdnqwdk", className : 'english'},{key : "likubqwd", className : 'robotics'},];
  </code></pre>
  
  <p>I need to return another array that contains objects like classesInList only if the key (as the className property) exists in classKeys</p>
  
  <p>For example, in this scenario, I would need to check the classKeys against the classesInList and create an array with two items :</p>
  
  <pre><code>[{key : "WIHUGDYVWJ", className : 'math'},{key : "likubqwd", className : 'robotics'}]
  </code></pre>
  
  <p>since english is not in the classKeys, it is deleted from the classesInList.
  How would I go about this?</p>
  
  <p>Side Note: I am using react native so I have access to es6 properties and functions.</p>
  
  <p>I am completely stuck in this sense. No matter how simple this seems to be I just cannot find an answer.</p>