Created
August 23, 2012 04:18
-
-
Save loktar00/3432238 to your computer and use it in GitHub Desktop.
Random Sum function
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
| var sum = function(){ | |
| var arr = [].slice.apply(arguments), | |
| total = arr.reduce(function(a,b){ | |
| b = parseInt(b); | |
| if(!isNaN(b)){ | |
| return a+b; | |
| }else{ | |
| return a; | |
| } | |
| }); | |
| return total; | |
| } | |
| |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment