Skip to content

Instantly share code, notes, and snippets.

@mfrachet
Created January 15, 2019 13:52
Show Gist options
  • Save mfrachet/dee0704d606fcc975da9f3184a8ee711 to your computer and use it in GitHub Desktop.
Save mfrachet/dee0704d606fcc975da9f3184a8ee711 to your computer and use it in GitHub Desktop.
array-apis.js
const isEven = x => x % 2 === 0;
const double = x => x * 2;
const array = [1, 2, 3, 4, 5];
const evenNumber = array.filter(isEven);
const doubleEven = evenNumber.map(double); // doubleEven is [4, 8]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment