Last active
July 31, 2016 19:03
-
-
Save sethschori/656eb14e383636de3982699dc178fa10 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
FILTER FUN | |
Create a function myFilter(arr, filter) that takes an array of letters and a 'filter' character. | |
The function should return a new ordered array of every element in the input array that is after the 'filter' alphabetically. You can assume the characters will always be lower case | |
ex | |
myFilter(['b', 'w', 'a', 'p', 'v'] , 'c') ==> ['p', 'v', 'w'] | |
*/ | |
function myFilter(lettersArray, filterLetter) { | |
return lettersArray.filter(function(letter) {return letter > filterLetter;}).sort(); | |
} | |
console.log(myFilter(['b', 'w', 'a', 'p', 'v'] , 'c')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Native Browser JavaScript | |
[ 'p', 'v', 'w' ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment