Skip to content

Instantly share code, notes, and snippets.

@adamgiese
Created July 17, 2018 13:03
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 adamgiese/284b7d1f14a63c70e82e592c869feb2e to your computer and use it in GitHub Desktop.
Save adamgiese/284b7d1f14a63c70e82e592c869feb2e to your computer and use it in GitHub Desktop.
Declarative Arrays: Square map
const numbers = [1,2,3,4,5];
const squares = numbers.map(currentValue => currentValue * currentValue);
console.log(squares); // [1,4,9,16,25];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment