js-mentorship-razvan / javascript

Javascript study notes
GNU General Public License v3.0
22 stars 2 forks source link

Filter out the geese #331

Open RazvanBugoi opened 5 years ago

RazvanBugoi commented 5 years ago

https://www.codewars.com/kata/filter-out-the-geese/train/javascript

DobroTora commented 2 years ago

//trick is that the breeds of geese are being mixed into the array of birds and the geese variable already represents them. All you have to do is exclude geese from a given array of birds.

function gooseFilter (birds) { var geese = ["African", "Roman Tufted", "Toulouse", "Pilgrim", "Steinbacher"];

// return an array containing all of the strings in the input array except those that match strings in geese var filtered = birds.filter(item => !geese.includes(item))

return filtered;

};