Table of Contents for
Practical Modern JavaScript
Close
Version ebook
/
Retour
Practical Modern JavaScript
by Nicolas Bevacqua
Published by O'Reilly Media, Inc., 2017
nav
Cover
Praise for Practical Modern JavaScript
Practical Modern JavaScript
Practical Modern JavaScript
Foreword
Preface
ECMAScript and the Future of JavaScript
ES6 Essentials
Classes, Symbols, Objects, and Decorators
Iteration and Flow Control
Leveraging ECMAScript Collections
Managing Property Access with Proxies
Built-in Improvements in ES6
JavaScript Modules
Practical Considerations
Index
About the Author
Colophon
Foreword
Preface
Who Should Read This Book
Why Modern JavaScript?
How Is This Book Organized?
Conventions Used in This Book
O’Reilly Safari
How to Contact Us
Acknowledgments
ECMAScript and the
Future of JavaScript
1.1 A Brief History of JavaScript Standards
1.2 ECMAScript as a Rolling Standard
1.3 Browser Support and Complementary Tooling
1.3.1 Introduction to the Babel Transpiler
1.3.2 Code Quality and Consistency with ESLint
1.4 Feature Themes in ES6
1.5 Future of JavaScript
ES6 Essentials
2.1 Object Literals
2.1.1 Property Value Shorthands
2.1.2 Computed Property Names
2.1.3 Method Definitions
2.2 Arrow Functions
2.2.1 Lexical Scoping
2.2.2 Arrow Function Flavors
2.2.3 Merits and Use Cases
2.3 Assignment Destructuring
2.3.1 Destructuring Objects
2.3.2 Destructuring Arrays
2.3.3 Function Parameter Defaults
2.3.4 Function Parameter Destructuring
2.3.5 Use Cases for Destructuring
2.4 Rest Parameter and Spread Operator
2.4.1 Rest Parameters
2.4.2 Spread Operator
2.5 Template Literals
2.5.1 String Interpolation
2.5.2 Multiline Template Literals
2.5.3 Tagged Templates
2.6 let and const Statements
2.6.1 Block Scoping and let Statements
2.6.2 Temporal Dead Zone
2.6.3 Const Statements
2.6.4 Merits of const and let
Classes, Symbols, Objects,
and Decorators
3.1 Classes
3.1.1 Class Fundamentals
3.1.2 Properties and Methods in Classes
3.1.3 Extending JavaScript Classes
3.2 Symbols
3.2.1 Local Symbols
3.2.2 Practical Use Cases for Symbols
3.2.3 Global Symbol Registry
3.2.4 Well-Known Symbols
3.3 Object Built-in Improvements
3.3.1 Extending Objects with Object.assign
3.3.2 Comparing Objects with Object.is
3.3.3 Object.setPrototypeOf
3.4 Decorators
3.4.1 A Primer on JavaScript Decorators
3.4.2 Stacking Decorators and a Warning About Immutability
3.4.3 Use Case By Example: Attributes in C#
3.4.4 Marking Properties in JavaScript
Iteration and Flow Control
4.1 Promises
4.1.1 Getting Started with Promises
4.1.2 Promise Continuation and Chaining
4.1.3 Creating a Promise from Scratch
4.1.4 Promise States and Fates
4.1.5 Promise#finally Proposal
4.1.6 Leveraging Promise.all and Promise.race
4.2 Iterator Protocol and Iterable Protocol
4.2.1 Understanding Iteration Principles
4.2.2 Infinite Sequences
4.2.3 Iterating Object Maps as Key/Value Pairs
4.2.4 Building Versatility Into Iterating a Playlist
4.3 Generator Functions and Generator Objects
4.3.1 Generator Fundamentals
4.3.2 Iterating over Generators by Hand
4.3.3 Mixing Generators into Iterables
4.3.4 Tree Traversal Using Generators
4.3.5 Consuming Generator Functions for Flexibility
4.3.6 Dealing with Asynchronous Flows
4.3.7 Throwing Errors at a Generator
4.3.8 Returning on Behalf of a Generator
4.3.9 Asynchronous I/O Using Generators
4.4 Async Functions
4.4.1 Flavors of Async Code
4.4.2 Using async/await
4.4.3 Concurrent Async Flows
4.4.4 Error Handling
4.4.5 Understanding Async Function Internals
4.5 Asynchronous Iteration
4.5.1 Async Iterators
4.5.2 Async Generators
Leveraging ECMAScript Collections
5.1 Using ES6 Maps
5.1.1 First Look into ES6 Maps
5.1.2 Hash-Maps and the DOM
5.2 Understanding and Using WeakMap
5.2.1 Is WeakMap a Worse Map?
5.3 Sets in ES6
5.4 ES6 WeakSets
Managing Property Access
with Proxies
6.1 Getting Started with Proxy
6.1.1 Trapping get Accessors
6.1.2 Trapping set Accessors
6.1.3 Schema Validation with Proxies
6.2 Revocable Proxies
6.3 Proxy Trap Handlers
6.3.1 has Trap
6.3.2 deleteProperty Trap
6.3.3 defineProperty Trap
6.3.4 ownKeys Trap
6.4 Advanced Proxy Traps
6.4.1 getOwnPropertyDescriptor Trap
6.4.2 apply Trap
6.4.3 construct Trap
6.4.4 getPrototypeOf Trap
6.4.5 setPrototypeOf Trap
6.4.6 preventExtensions Trap
6.4.7 isExtensible Trap
Built-in Improvements in ES6
7.1 Numbers
7.1.1 Binary and Octal Literals
7.1.2 Number.isNaN
7.1.3 Number.isFinite
7.1.4 Number.parseInt
7.1.5 Number.parseFloat
7.1.6 Number.isInteger
7.1.7 Number.EPSILON
7.1.8 Number.MAX_SAFE_INTEGER and Number.MIN_SAFE_INTEGER
7.1.9 Number.isSafeInteger
7.2 Math
7.2.1 Math.sign
7.2.2 Math.trunc
7.2.3 Math.cbrt
7.2.4 Math.expm1
7.2.5 Math.log1p
7.2.6 Math.log10
7.2.7 Math.log2
7.2.8 Trigonometric Functions
7.2.9 Math.hypot
7.2.10 Bitwise Computation Helpers
7.3 Strings and Unicode
7.3.1 String#startsWith
7.3.2 String#endsWith
7.3.3 String#includes
7.3.4 String#repeat
7.3.5 String Padding and Trimming
7.3.6 Unicode
7.3.7 String.prototype[Symbol.iterator]
7.3.8 A Proposal to Split Grapheme Segments
7.3.9 String#codePointAt
7.3.10 String.fromCodePoint
7.3.11 Unicode-Aware String Reversal
7.3.12 String#normalize
7.4 Regular Expressions
7.4.1 Sticky Matching Flag /y
7.4.2 Unicode Flag /u
7.4.3 Named Capture Groups
7.4.4 Unicode Property Escapes
7.4.5 Lookbehind Assertions
7.4.6 A New /s “dotAll” Flag
7.4.7 String#matchAll
7.5 Array
7.5.1 Array.from
7.5.2 Array.of
7.5.3 Array#copyWithin
7.5.4 Array#fill
7.5.5 Array#find and Array#findIndex
7.5.6 Array#keys
7.5.7 Array#values
7.5.8 Array#entries
7.5.9 Array.prototype[Symbol.iterator]
JavaScript Modules
8.1 CommonJS
8.2 JavaScript Modules
8.2.1 Strict Mode
8.2.2 export Statements
8.2.3 import Statements
8.2.4 Dynamic import()
8.3 Practical Considerations for ES Modules
Practical Considerations
9.1 Variable Declarations
9.2 Template Literals
9.3 Shorthand Notation and Object Destructuring
9.4 Rest and Spread
9.5 Savoring Function Flavors
9.6 Classes and Proxies
9.7 Asynchronous Code Flows
9.8 Complexity Creep, Abstractions, and Conventions
Index