Created
August 17, 2015 04:18
-
-
Save tarot/2a9db73887a6fd39181c to your computer and use it in GitHub Desktop.
you can't javascript under pressure #5
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
| function(i) { | |
| var fn = function(sum, e) { | |
| if (typeof e === typeof 0) return sum + e; | |
| if (e instanceof Array) return e.reduce(fn, sum); | |
| return sum; | |
| }; | |
| return i.reduce(fn, 0); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment