We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
例如
function add(){//...} add(1)(2,3)(4).value() 输出: 10
The text was updated successfully, but these errors were encountered:
可以利用闭包的机制保存一个变量,add 执行时对这个私有变量做操作,当调用 value() 时返回结果即可。
value()
const add = (function () { let result = 0; function add(...nums) { result += nums.reduce((a, b) => a + b); return add; } add.value = function () { return result; }; return add; })();
Sorry, something went wrong.
No branches or pull requests
例如
The text was updated successfully, but these errors were encountered: