-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFilteroutthegeese.js
More file actions
24 lines (18 loc) · 1.02 KB
/
Filteroutthegeese.js
File metadata and controls
24 lines (18 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* Instructions:
Your function would return the following array:
["Mallard", "Hook Bill", "Crested", "Blue Swedish"]
The elements in the returned array should be in the same order as in the initial array passed to your function, albeit with the 'geese' removed. Note that all of the strings will be in the same case as those provided, and some elements may be repeated.
*/
//Answer
//P(arameters) array of strings
//R(eturn) return array that does include any of geeses from geese array
//E(xample) For example, if this array were passed as an argument:
//["Mallard", "Hook Bill", "African", "Crested", "Pilgrim", "Toulouse", "Blue Swedish"]
// function should return the following array:
// ["Mallard", "Hook Bill", "Crested", "Blue Swedish"]
//P(seudo)
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
return birds.filter((bird) => !geese.includes(bird));
}