You are previewing You Don't Know JS: ES6 & Beyond.
O'Reilly logo
You Don't Know JS: ES6 & Beyond

Book Description

No matter how much experience you have with JavaScript, odds are you don’t fully understand the language. As part of the "You Don’t Know JS" series, this compact guide focuses on new features available in ECMAScript 6 (ES6), the latest version of the standard upon which JavaScript is built.

Like other books in this series, You Don’t Know JS: ES6 & Beyond dives into trickier parts of the language that many JavaScript programmers either avoid or know nothing about. Armed with this knowledge, you can achieve true JavaScript mastery.

With this book, you will:

  • Learn new ES6 syntax that eases the pain points of common programming idioms
  • Organize code with iterators, generators, modules, and classes
  • Express async flow control with Promises combined with generators
  • Use collections to work more efficiently with data in structured ways
  • Leverage new API helpers, including Array, Object, Math, Number, and String
  • Extend your program’s capabilities through meta programming
  • Preview features likely coming to JS beyond ES6

Table of Contents

  1. Foreword
  2. Preface
    1. Mission
    2. Review
    3. Conventions Used in This Book
    4. Using Code Examples
    5. Safari® Books Online
    6. How to Contact Us
  3. 1. ES? Now & Future
    1. Versioning
    2. Transpiling
      1. Shims/Polyfills
    3. Review
  4. 2. Syntax
    1. Block-Scoped Declarations
      1. let Declarations
      2. const Declarations
      3. Block-Scoped Functions
    2. Spread/Rest
    3. Default Parameter Values
      1. Default Value Expressions
    4. Destructuring
      1. Object Property Assignment Pattern
      2. Not Just Declarations
      3. Repeated Assignments
      4. Too Many, Too Few, Just Enough
      5. Default Value Assignment
      6. Nested Destructuring
      7. Destructuring Parameters
    5. Object Literal Extensions
      1. Concise Properties
      2. Concise Methods
      3. Computed Property Names
      4. Setting [[Prototype]]
      5. Object super
    6. Template Literals
      1. Interpolated Expressions
      2. Tagged Template Literals
    7. Arrow Functions
      1. Not Just Shorter Syntax, But this
    8. for..of Loops
    9. Regular Expressions
      1. Unicode Flag
      2. Sticky Flag
      3. Regular Expression flags
    10. Number Literal Extensions
    11. Unicode
      1. Unicode-Aware String Operations
      2. Character Positioning
      3. Unicode Identifier Names
    12. Symbols
      1. Symbol Registry
      2. Symbols as Object Properties
    13. Review
  5. 3. Organization
    1. Iterators
      1. Interfaces
      2. next() Iteration
      3. Optional: return(..) and throw(..)
      4. Iterator Loop
      5. Custom Iterators
      6. Iterator Consumption
    2. Generators
      1. Syntax
      2. Iterator Control
      3. Early Completion
      4. Error Handling
      5. Transpiling a Generator
      6. Generator Uses
    3. Modules
      1. The Old Way
      2. Moving Forward
      3. The New Way
      4. Circular Module Dependency
      5. Module Loading
    4. Classes
      1. class
      2. extends and super
      3. new.target
      4. static
    5. Review
  6. 4. Async Flow Control
    1. Promises
      1. Making and Using Promises
      2. Thenables
      3. Promise API
    2. Generators + Promises
    3. Review
  7. 5. Collections
    1. TypedArrays
      1. Endianness
      2. Multiple Views
      3. Typed Array Constructors
    2. Maps
      1. Map Values
      2. Map Keys
    3. WeakMaps
    4. Sets
      1. Set Iterators
    5. WeakSets
    6. Review
  8. 6. API Additions
    1. Array
      1. Array.of(..) Static Function
      2. Array.from(..) Static Function
      3. Creating Arrays and Subtypes
      4. copyWithin(..) Prototype Method
      5. fill(..) Prototype Method
      6. find(..) Prototype Method
      7. findIndex(..) Prototype Method
      8. entries(), values(), keys() Prototype Methods
    2. Object
      1. Object.is(..) Static Function
      2. Object.getOwnPropertySymbols(..) Static Function
      3. Object.setPrototypeOf(..) Static Function
      4. Object.assign(..) Static Function
    3. Math
    4. Number
      1. Static Properties
      2. Number.isNaN(..) Static Function
      3. Number.isFinite(..) Static Function
      4. Integer-Related Static Functions
    5. String
      1. Unicode Functions
      2. String.raw(..) Static Function
      3. repeat(..) Prototype Function
      4. String Inspection Functions
    6. Review
  9. 7. Meta Programming
    1. Function Names
      1. Inferences
    2. Meta Properties
    3. Well-Known Symbols
      1. Symbol.iterator
      2. Symbol.toStringTag and Symbol.hasInstance
      3. Symbol.species
      4. Symbol.toPrimitive
      5. Regular Expression Symbols
      6. Symbol.isConcatSpreadable
      7. Symbol.unscopables
    4. Proxies
      1. Proxy Limitations
      2. Revocable Proxies
      3. Using Proxies
    5. Reflect API
      1. Property Ordering
    6. Feature Testing
      1. FeatureTests.io
    7. Tail Call Optimization (TCO)
      1. Tail Call Rewrite
      2. Non-TCO Optimizations
      3. Meta?
    8. Review
  10. 8. Beyond ES6
    1. async functions
      1. Caveats
    2. Object.observe(..)
      1. Custom Change Events
      2. Ending Observation
    3. Exponentiation Operator
    4. Objects Properties and ...
    5. Array#includes(..)
    6. SIMD
    7. WebAssembly (WASM)
    8. Review
  11. A. Acknowledgments