Last active
August 29, 2015 14:22
-
-
Save dferber90/962bbcc9b84233a338fd to your computer and use it in GitHub Desktop.
Rest Operator in ES6
This file contains 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
// ES6 | |
UI.registerHelper('sum', function (...summands) { | |
summands.pop(); // remove last argument hash (Spacebars.kw) | |
return summands.reduce((previousValue, currentValue) => { | |
return previousValue + currentValue; | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment