Last active
August 29, 2015 14:14
-
-
Save nadeesha/0def220c7cc8e24ccf94 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
function (args) { | |
function addArray(arr) { | |
if (arr.length === 1) { | |
return Number(arr[0]); | |
} | |
return Number(arr[0]) + addArray(arr.slice(1)); | |
} | |
this.exec = function (cb) { | |
cb(addArray(args)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment