Last active
November 28, 2018 13:27
-
-
Save Yago/16802aac3430d8403c40065ba565121e to your computer and use it in GitHub Desktop.
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
sum(31,7,4); // return 42 | |
function sum() { | |
return [...arguments].reduce(function (acc, n) { | |
if (typeof n === 'number') return acc + n; | |
return acc; | |
}, 0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment