Skip to content

Instantly share code, notes, and snippets.

@jasonbellamy
Created September 23, 2015 21:25
Show Gist options
  • Save jasonbellamy/6d7a5b4dad1f44007e7b to your computer and use it in GitHub Desktop.
Save jasonbellamy/6d7a5b4dad1f44007e7b to your computer and use it in GitHub Desktop.
Succinct version of the square function written in ES6
const square = (...args) => args.map((arg) => arg * arg);
square(1, 2, 3, 4, 5); // => [1, 4, 9, 16, 25]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment