Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 44252ad

Browse files
authored
Merge pull request #2228 from vsemozhetbyt/patch-13
Fix possible typo in 1.6.7 ("new Function" syntax)
2 parents decb6a2 + 518daec commit 44252ad

File tree

1 file changed

+1
-1
lines changed
  • 1-js/06-advanced-functions/07-new-function

1 file changed

+1
-1
lines changed

‎1-js/06-advanced-functions/07-new-function/article.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ What if it could access the outer variables?
9292

9393
The problem is that before JavaScript is published to production, it's compressed using a *minifier* -- a special program that shrinks code by removing extra comments, spaces and -- what's important, renames local variables into shorter ones.
9494

95-
For instance, if a function has `let userName`, minifier replaces it `let a` (or another letter if this one is occupied), and does it everywhere. That's usually a safe thing to do, because the variable is local, nothing outside the function can access it. And inside the function, minifier replaces every mention of it. Minifiers are smart, they analyze the code structure, so they don't break anything. They're not just a dumb find-and-replace.
95+
For instance, if a function has `let userName`, minifier replaces it with `let a` (or another letter if this one is occupied), and does it everywhere. That's usually a safe thing to do, because the variable is local, nothing outside the function can access it. And inside the function, minifier replaces every mention of it. Minifiers are smart, they analyze the code structure, so they don't break anything. They're not just a dumb find-and-replace.
9696

9797
So if `new Function` had access to outer variables, it would be unable to find renamed `userName`.
9898

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /