This book dives deeply into JavaScript:
- It teaches practical techniques for using the language better.
- It teaches how the language works and why. What it teaches is firmly grounded in the ECMAScript specification (which the book explains and refers to).
- It covers only the language (ignoring platform-specific features such as browser APIs) but not exhaustively. Instead, it focuses on a selection of important topics.
- Title
- Deep JavaScript
- Subtitle
- Theory and techniques
- Author(s)
- Dr. Axel Rauschmayer
- Published
- 2020-07-02
- Edition
- 1
- Format
- eBook (pdf, epub, mobi)
- Pages
- 226
- Language
- English
- License
- Read online for free
- Book Homepage
- Free eBook, Errata, Code, Solutions, etc.
Deep JavaScript Deep JavaScript About this book Where is the homepage of this book? What is in this book? What do I get for my money? How can I preview the content? How do I report errors? Tips for reading Notations and conventions Acknowledgements Type coercion in JavaScript What is type coercion? Operations that help implement coercion in the ECMAScript specification Intermission: expressing specification algorithms in JavaScript Example coercion algorithms Operations that coerce Glossary: terms related to type conversion The destructuring algorithm Preparing for the pattern matching algorithm The pattern matching algorithm Empty object patterns and Array patterns Applying the algorithm A detailed look at global variables Scopes Lexical environments The global object In browsers, globalThis does not point directly to the global object The global environment Conclusion: Why does JavaScript have both normal global variables and the global object? Further reading and sources of this chapter % is a remainder operator, not a modulo operator (bonus) Remainder operator rem vs. modulo operator mod An intuitive understanding of the remainder operation An intuitive understanding of the modulo operation Similarities and differences between rem and mod The equations behind remainder and modulo Where are rem and mod used in programming languages? Further reading and sources of this chapter Copying objects and Arrays Shallow copying vs. deep copying Shallow copying in JavaScript Deep copying in JavaScript Further reading Updating data destructively and non-destructively Examples: updating an object destructively and non-destructively Examples: updating an Array destructively and non-destructively Manual deep updating Implementing generic deep updating The problems of shared mutable state and how to avoid them What is shared mutable state and why is it problematic? Avoiding sharing by copying data Avoiding mutations by updating non-destructively Preventing mutations by making data immutable Libraries for avoiding shared mutable state Property attributes: an introduction The structure of objects Property descriptors Retrieving descriptors for properties Defining properties via descriptors Object.create(): Creating objects via descriptors Use cases for Object.getOwnPropertyDescriptors() Omitting descriptor properties What property attributes do built-in constructs use? API: property descriptors Further reading Protecting objects from being changed Levels of protection: preventing extensions, sealing, freezing Preventing extensions of objects Sealing objects Freezing objects Further reading Properties: assignment vs. definition Assignment vs. definition Assignment and definition in theory (optional) Definition and assignment in practice Which language constructs use definition, which assignment? Further reading and sources of this chapter Enumerability of properties How enumerability affects property-iterating constructs The enumerability of pre-defined and created properties Use cases for enumerability Conclusion Techniques for instantiating classes The problem: initializing a property asynchronously Solution: Promise-based constructor Solution: static factory method Subclassing a Promise-based constructor (optional) Conclusion Further reading Copying instances of classes: .clone() vs. copy constructors .clone() methods Static factory methods Acknowledgements Immutable wrappers for collections Wrapping objects An immutable wrapper for Maps An immutable wrapper for Arrays Regular expressions: lookaround assertions by example Cheat sheet: lookaround assertions Warnings for this chapter Example: Specifying what comes before or after a match (positive lookaround) Example: Specifying what does not come before or after a match (negative lookaround) Interlude: pointing lookaround assertions inward Example: match strings not starting with 'abc' Example: match substrings that do not contain '.mjs' Example: skipping lines with comments Example: smart quotes Acknowledgements Further reading Composing regular expressions via re-template-tag (bonus) The basics A tour of the features Why is this useful? re and named capture groups Exploring Promises by implementing them Refresher: states of Promises Version 1: Stand-alone Promise Version 2: Chaining .then() calls Convenience method .catch() Omitting reactions The implementation Version 3: Flattening Promises returned from .then() callbacks Version 4: Exceptions thrown in reaction callbacks Version 5: Revealing constructor pattern Metaprogramming with Proxies (early access) Overview Programming versus metaprogramming Proxies explained Use cases for Proxies The design of the Proxy API FAQ: Proxies Reference: the Proxy API Conclusion Further reading The property .name of functions (bonus) Names of functions Constructs that provide names for functions Things to look out for with names of functions Changing the names of functions The function property .name in the ECMAScript specification
Related Books