Skip to content

Instantly share code, notes, and snippets.

@mannuelf
Created January 1, 2017 20:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mannuelf/88ed7c8e78f2dfcef424059f745ee69f to your computer and use it in GitHub Desktop.
Save mannuelf/88ed7c8e78f2dfcef424059f745ee69f to your computer and use it in GitHub Desktop.
Create a function called 'reject'. Reject should work in the opposite way of 'filter' - if a function returns 'true', the item should *not* be included in the new array.
const numbers = [ 10, 20, 30, 40, 50, 60 ];
function reject(numbers, iteratorFunction) {
return numbers.filter(function(number){
return (number < 15);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment