Scope and Closures by Kyle Simpson

Scope and Closures by Kyle Simpson

Author:Kyle Simpson
Language: eng
Format: epub, mobi, pdf
ISBN: 9781449335588
Publisher: O’Reilly Media, Inc.
Published: 2014-06-14T16:00:00+00:00


The block-scoping nature of catch may seem like a useless academic fact, but see Appendix B for more information on just how useful it might be.

let

Thus far, we’ve seen that JavaScript only has some strange niche behaviors that expose block scope functionality. If that were all we had, and it was for many, many years, then block scoping would not be terribly useful to the JavaScript developer.

Fortunately, ES6 changes that, and introduces a new keyword let, which sits alongside var as another way to declare variables.

The let keyword attaches the variable declaration to the scope of whatever block (commonly a { .. } pair) it’s contained in. In other words, let implicitly hijacks any block’s scope for its variable declaration.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.