Last active
August 30, 2018 23:07
-
-
Save Silva97/4ebe20f00de1f60917103b9abdb54381 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 sum(...args){ | |
var result = 0; | |
if(args.length == 4){ | |
for(let i = 0; i < args.length; i++) | |
result += args[i]; | |
return result; | |
} else { | |
return function(...newArgs){ | |
return sum(...args, ...newArgs); | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment