Filter objects out of an array in JS I have an array of objects arr. One object looks like this: 

obj = {
  name: 'name'
  email: 'email'
}


And then I have an array with strings (emails) 

var excludedEmails = ['email1','email2',...]


I want to filter the excluded emails out of the arr. 

Is there a better/faster way than this in VanillaJS (I am assuming the strings in excludedEmails are all upper case: 

var filteredPersons = []
arr.forEach(function(person){
      if(!excludedEmails.includes(person.email.toUpperCase())){
        filteredPersons.push(person);
      }
})
The filter function is what you're looking for. Here's an example given on the documentation page that should demonstrate exactly how it's used:

var words = ["spray", "limit", "elite", "exuberant", "destruction", "present"];

var longWords = words.filter(function(word){
  return word.length &gt; 6;
});

// Filtered array longWords is ["exuberant", "destruction", "present"]


Additionally, the map function can be useful to iterate through arrays to apply a function to each value in the array instead of just filtering out values based on a bool result (in your case, whether the email is in excluded emails). For a basic check to see if the email address is excluded, you'll want filter. If you do any processing on the emails array (say, sending emails), you may want to look into map.