Skip to content

Instantly share code, notes, and snippets.

@stevencch99
Created May 11, 2019 12:48
Show Gist options
  • Save stevencch99/8e7d99f18d32a9515b6e8cc69335ccfa to your computer and use it in GitHub Desktop.
Save stevencch99/8e7d99f18d32a9515b6e8cc69335ccfa to your computer and use it in GitHub Desktop.
// Example in JavaScript
let numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
function isEven(x){
return x % 2 === 0;
}
let evenNumbers = numbers.filter(isEven);
// 2 4 6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment