Download Understanding ECMAScript 6 The Definitive Guide for javascript Developers PDF

TitleUnderstanding ECMAScript 6 The Definitive Guide for javascript Developers
File Size10.5 MB
Total Pages355
Table of Contents
	The Road to ECMAScript 6
	About This Book
		Browser and Node.js Compatibility
		Who This Book Is For
		Conventions Used
		Help and Support
Chapter 1: Block Bindings
	var Declarations and Hoisting
	Block-Level Declarations
		let Declarations
		No Redeclaration
		const Declarations
		The Temporal Dead Zone
	Block Bindings in Loops
		Functions in Loops
		let Declarations in Loops
		const Declarations in Loops
	Global Block Bindings
	Emerging Best Practices for Block Bindings
Chapter 2: Strings and Regular Expressions
	Better Unicode Support
		UTF-16 Code Points
		The codePointAt() Method
		The String.fromCodePoint() Method
		The normalize() Method
		The Regular Expression u Flag
	Other String Changes
		Methods for Identifying Substrings
		The repeat() Method
	Other Regular Expression Changes
		The Regular Expression y Flag
		Duplicating Regular Expressions
		The flags Property
	Template Literals
		Basic Syntax
		Multiline Strings
		Making Substitutions
		Tagged Templates
Chapter 3: Functions
	Functions with Default Parameter Values
		Simulating Default Parameter Values in ECMAScript 5
		Default Parameter Values in ECMAScript 6
		How Default Parameter Values Affect the arguments Object
		Default Parameter Expressions
		Default Parameter TDZ
	Working with Unnamed Parameters
		Unnamed Parameters in ECMAScript 5
		Rest Parameters
	Increased Capabilities of the Function Constructor
	The Spread Operator
	The name Property
		Choosing Appropriate Names
		Special Cases of the name Property
	Clarifying the Dual Purpose of Functions
		Determining How a Function Was Called in ECMAScript 5
		The Metaproperty
	Block-Level Functions
		Deciding When to Use Block-Level Functions
		Block-Level Functions in Non-Strict Mode
	Arrow Functions
		Arrow Function Syntax
		Creating Immediately Invoked Function Expressions
		No this Binding
		Arrow Functions and Arrays
		No arguments Binding
		Identifying Arrow Functions
	Tail Call Optimization
		How Tail Calls Are Different in ECMAScript 6
		How to Harness Tail Call Optimization
Chapter 4: Expanded Object Functionality
	Object Categories
	Object Literal Syntax Extensions
		Property Initializer Shorthand
		Concise Methods
		Computed Property Names
	New Methods
		The Method
		The Object.assign() Method
	Duplicate Object Literal Properties
	Own Property Enumeration Order
	Enhancements for Prototypes
		Changing an Object’s Prototype
		Easy Prototype Access with Super References
	A Formal Method Definition
Chapter 5: Destructuring for Easier Data Access
	Why Is Destructuring Useful?
	Object Destructuring
		Destructuring Assignment
		Default Values
		Assigning to Different Local Variable Names
		Nested Object Destructuring
	Array Destructuring
		Destructuring Assignment
		Default Values
		Nested Destructuring
		Rest Items
	Mixed Destructuring
	Destructured Parameters
		Destructured Parameters Are Required
		Default Values for Destructured Parameters
Chapter 6: Symbols and Symbol Properties
	Creating Symbols
	Using Symbols
	Sharing Symbols
	Symbol Coercion
	Retrieving Symbol Properties
	Exposing Internal Operations with Well-Known Symbols
		The Symbol.hasInstance Method
		The Symbol.isConcatSpreadable Property
		The Symbol.match, Symbol.replace,, and Symbol.split Properties
		The Symbol.toPrimitive Method
		The Symbol.toStringTag Property
		The Symbol.unscopables Property
Chapter 7: Sets and Maps
	Sets and Maps in ECMAScript 5
	Problems with Workarounds
	Sets in ECMAScript 6
		Creating Sets and Adding Items
		Removing Items
		The forEach() Method for Sets
		Converting a Set to an Array
		Weak Sets
	Maps in ECMAScript 6
		Map Methods
		Map Initialization
		The forEach() Method for Maps
		Weak Maps
Chapter 8: Iterators and Generators
	The Loop Problem
	What Are Iterators?
	What Are Generators?
		Generator Function Expressions
		Generator Object Methods
	Iterables and for-of Loops
		Accessing the Default Iterator
		Creating Iterables
	Built-In Iterators
		Collection Iterators
		String Iterators
		NodeList Iterators
	The Spread Operator and Nonarray Iterables
	Advanced Iterator Functionality
		Passing Arguments to Iterators
		Throwing Errors in Iterators
		Generator Return Statements
		Delegating Generators
	Asynchronous Task Running
		A Simple Task Runner
		Task Running with Data
		An Asynchronous Task Runner
Chapter 9: Introducing JavaScript Classes
	Class-Like Structures in ECMAScript 5
	Class Declarations
		A Basic Class Declaration
		Why Use the Class Syntax?
	Class Expressions
		A Basic Class Expression
		Named Class Expressions
	Classes as First-Class Citizens
	Accessor Properties
	Computed Member Names
	Generator Methods
	Static Members
	Inheritance with Derived Classes
		Shadowing Class Methods
		Inherited Static Members
		Derived Classes from Expressions
		Inheriting from Built-Ins
		The Symbol.species Property
	Using in Class Constructors
Chapter 10: Improved Array Capabilities
	Creating Arrays
		The Array.of() Method
		The Array.from() Method
	New Methods on All Arrays
		The find() and findIndex() Methods
		The fill() Method
		The copyWithin() Method
	Typed Arrays
		Numeric Data Types
		Array Buffers
		Manipulating Array Buffers with Views
	Similarities Between Typed and Regular Arrays
		Common Methods
		The Same Iterators
		The of() and from() Methods
	Differences Between Typed and Regular Arrays
		Behavioral Differences
		Missing Methods
		Additional Methods
Chapter 11: Promises and Asynchronous Programming
	Asynchronous Programming Background
		The Event Model
		The Callback Pattern
	Promise Basics
		The Promise Life Cycle
		Creating Unsettled Promises
		Creating Settled Promises
		Executor Errors
	Global Promise Rejection Handling
		Node.js Rejection Handling
		Browser Rejection Handling
	Chaining Promises
		Catching Errors
		Returning Values in Promise Chains
		Returning Promises in Promise Chains
	Responding to Multiple Promises
		The Promise.all() Method
		The Promise.race() Method
	Inheriting from Promises
	Asynchronous Task Running
Chapter 12: Proxies and the Reflection API
	The Array Problem
	Introducing Proxies and Reflection
	Creating a Simple Proxy
	Validating Properties Using the set Trap
	Object Shape Validation Using the get Trap
	Hiding Property Existence Using the has Trap
	Preventing Property Deletion with the deleteProperty Trap
	Prototype Proxy Traps
		How Prototype Proxy Traps Work
		Why Two Sets of Methods?
	Object Extensibility Traps
		Two Basic Examples
		Duplicate Extensibility Methods
	Property Descriptor Traps
		Blocking Object.defineProperty()
		Descriptor Object Restrictions
		Duplicate Descriptor Methods
	The ownKeys Trap
	Function Proxies with the apply and construct Traps
		Validating Function Parameters
		Calling Constructors Without new
		Overriding Abstract Base Class Constructors
		Callable Class Constructors
	Revocable Proxies
	Solving the Array Problem
		Detecting Array Indexes
		Increasing length when Adding New Elements
		Deleting Elements When Reducing length
		Implementing the MyArray Class
	Using a Proxy as a Prototype
		Using the get Trap on a Prototype
		Using the set Trap on a Prototype
		Using the has Trap on a Prototype
		Proxies as Prototypes on Classes
Chapter 13: Encapsulating Code with Modules
	What Are Modules?
	Basic Exporting
	Basic Importing
		Importing a Single Binding
		Importing Multiple Bindings
		Importing an Entire Module
		A Subtle Quirk of Imported Bindings
	Renaming Exports and Imports
	Default Values in Modules
		Exporting Default Values
		Importing Default Values
	Re-exporting a Binding
	Importing Without Bindings
	Loading Modules
		Using Modules in Web Browsers
		Browser Module Specifier Resolution
Appendix A: Minor Changes in ECMAScript 6
	Working with Integers
		Identifying Integers
		Safe Integers
	New Math Methods
	Unicode Identifiers
	Formalizing the __proto__ Property
Appendix B: Understanding ECMAScript 7 (2016)
	The Exponentiation Operator
		Order of Operations
		Operand Restriction
	The Array.prototype.includes() Method
		How to Use Array.prototype.includes()
		Value Comparison
	A Change to Function-Scoped Strict Mode

Similer Documents