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
No description provided.
The text was updated successfully, but these errors were encountered:
let A = (function(){ let idx = 0; return function(){ idx++; if(idx % 2 === 1) console.log(1); else console.log(2); } })() A(); A(); A();
闭包应用
Sorry, something went wrong.
function main(){ let num = 0; return function(){ return (++num) % 2 === 1 ? 1 : 2; } }
function createFunction() { let count = 0; return function() { count++; if (count % 2 === 0) { return 2; } else { return 1; } }; } let a = createFunction(); console.log(a()); // 输出:1 console.log(a()); // 输出:2 console.log(a()); // 输出:1
No branches or pull requests
No description provided.
The text was updated successfully, but these errors were encountered: