Skip to content
New issue

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

Correct a code example #3162

Open
wants to merge 1 commit into
base: v2
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,15 @@ Even if `g` is called once `f` is done running, it will be able to access and mo
function f() {
var a = 1;

a = 2;
var b = g();
a = 3;

return b;

function g() {
a += 1;
return a;
}

return g;
}

f(); // returns '2'
f()(); // returns '2'
```

### Scoping rules
Expand Down Expand Up @@ -979,4 +976,4 @@ especially useful when consuming resources produced one at a time by a generator

`using` and `await using` declarations can be used when targeting older ECMAScript editions as long as you are using
a compatible polyfill for `Symbol.dispose`/`Symbol.asyncDispose`, such as the one provided by default in recent
editions of NodeJS.
editions of NodeJS.