Created
November 4, 2016 16:54
-
-
Save chengjianhua/a72e0327938146cfd0580f4e4874bff3 to your computer and use it in GitHub Desktop.
curray add
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 add() { | |
const param = arguments[0]; | |
let sum = arguments[1] || 0; | |
if (!param) { | |
return sum; | |
} else { | |
sum += param; | |
return function (...args) { | |
return add.call(null, args[0], sum); | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment