Skip to content

Instantly share code, notes, and snippets.

@chengjianhua
Created November 4, 2016 16:54
Show Gist options
  • Save chengjianhua/a72e0327938146cfd0580f4e4874bff3 to your computer and use it in GitHub Desktop.
Save chengjianhua/a72e0327938146cfd0580f4e4874bff3 to your computer and use it in GitHub Desktop.
curray add
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