What you need to know about this book
- Support
About the author
- IBackground
1.The TC39 process for ECMAScript features
- 1.1Who designs ECMAScript?
- 1.2How is ECMAScript designed?
- 1.2.1Problem: ECMAScript 2015 (ES6) was too large a release
- 1.2.2Solution: the TC39 process
- 1.3Don’t call them ECMAScript 20xx features
- 1.4Further reading
2.FAQ: ES2016 and ES2017
- 2.1Isn’t ECMAScript 2016 too small?
- IIECMAScript 2016
3.Array.prototype.includes
- 3.1Overview
- 3.2The Array method
includes - 3.3Frequently asked questions
- 3.4Further reading
4.Exponentiation operator (**)
- 4.1Overview
- 4.2An infix operator for exponentiation
- 4.3Examples
- 4.4Precedence
- 4.5Further reading
- IIIECMAScript 2017
5.Async functions
- 5.1Overview
- 5.1.1Variants
- 5.1.2Async functions always return Promises
- 5.1.3Handling results and errors of asynchronous computations via
await - 5.2Understanding async functions
- 5.2.1Writing asynchronous code via generators
- 5.2.2Writing asynchronous code via async functions
- 5.2.3Async functions are started synchronously, settled asynchronously
- 5.2.4Returned Promises are not wrapped
- 5.3Tips for using
await - 5.3.1Don’t forget
await - 5.3.2You don’t need
awaitif you “fire and forget” - 5.3.3
awaitis sequential,Promise.all()is parallel - 5.4Async functions and callbacks
- 5.4.1
Array.prototype.map() - 5.4.2
Array.prototype.forEach() - 5.5Tips for using async functions
- 5.5.1Know your Promises
- 5.5.2Immediately Invoked Async Function Expressions
- 5.5.3Unit testing with async functions
- 5.5.4Don’t worry about unhandled rejections
- 5.6Further reading
6.Shared memory and atomics
- 6.1Parallelism vs. concurrency
- 6.1.1Models of parallelism
- 6.2A history of JS parallelism
- 6.2.1The next step:
SharedArrayBuffer - 6.3Shared Array Buffers
- 6.3.1Creating and sending a Shared Array Buffer
- 6.3.2Receiving a Shared Array Buffer
- 6.4Atomics: safely accessing shared data
- 6.4.1Problem: Optimizations make code unpredictable across workers
- 6.4.2Solution: atomics
- 6.4.3Problem: torn values
- 6.5Shared Array Buffers in use
- 6.5.1Shared Array Buffers and the run-to-completion semantics of JavaScript
- 6.5.2Shared Array Buffers and asm.js and WebAssembly
- 6.5.3Sharing data other than integers
- 6.5.4How much faster is code that uses Shared Array Buffers?
- 6.6Example
- 6.6.1Using a shared lock
- 6.6.2Implementing a shared lock
- 6.6.3Conclusion for the example
- 6.7The API for shared memory and atomics
- 6.7.1
SharedArrayBuffer - 6.7.2
Atomics - 6.8FAQ
- 6.8.1What browsers support Shared Array Buffers?
- 6.9Further reading
7.Object.entries() and Object.values()
- 7.1Overview
- 7.1.1
Object.entries() - 7.1.2
Object.values() - 7.2
Object.entries() - 7.2.1Setting up Maps via
Object.entries() - 7.2.2FAQ:
Object.entries() - 7.3
Object.values()
8.New string methods: padStart and padEnd
- 8.1Overview
- 8.2Why pad strings?
- 8.3
String.prototype.padStart(maxLength, fillString=' ') - 8.3.1A simple implementation of
padStart() - 8.4
String.prototype.padEnd(maxLength, fillString=' ') - 8.5FAQ:
padStartandpadEnd - 8.5.1Why aren’t the padding methods called
padLeftandpadRight?
9.Object.getOwnPropertyDescriptors()
- 9.1Overview
- 9.2
Object.getOwnPropertyDescriptors() - 9.3Use cases for
Object.getOwnPropertyDescriptors() - 9.3.1Use case: copying properties into an object
- 9.3.2Use case: cloning objects
- 9.3.3Use case: cross-platform object literals with arbitrary prototypes
- 9.4Pitfall: copying methods that use
super
10.Trailing commas in function parameter lists and calls
- 10.1Overview
- 10.2Trailing commas in object literals and Array literals
- 10.3Feature: allow trailing commas in parameter definitions and function calls