Created
September 23, 2015 21:25
-
-
Save jasonbellamy/6d7a5b4dad1f44007e7b to your computer and use it in GitHub Desktop.
Succinct version of the square function written in ES6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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