diff --git a/packages/documentation/copy/en/reference/Variable Declarations.md b/packages/documentation/copy/en/reference/Variable Declarations.md index 0365f9f1f081..89b44df6d48b 100644 --- a/packages/documentation/copy/en/reference/Variable Declarations.md +++ b/packages/documentation/copy/en/reference/Variable Declarations.md @@ -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 @@ -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. \ No newline at end of file +editions of NodeJS.