Leanpub Header

Skip to main content

Understanding ECMAScript 6

ECMAScript 6 is coming, are you ready? There's a lot of new concepts to learn and understand. Get a headstart with this book!

The author is letting you choose the price you pay for this book!

Pick Your Price...
PDF
EPUB
WEB
1,339
Readers
317
Pages
87,059Words
About

About

About the Book

ECMAScript 6 represents the biggest change to the core of JavaScript in the history of the language. Not only does the sixth edition add new object types, but also new syntax and exciting new capabilities. The result of years of study and debate, ECMAScript 6 reached feature complete status in 2014. While it will take a bit of time before all JavaScript environments support ECMAScript 6, it's still useful to understand what's coming and which features are available already.

This book is a guide for the transition between ECMAScript 5 and 6. It is not specific to any JavaScript environment, so it is equally useful to web developers as it is Node.js developers.

What you'll learn:

  • All of the changes to the language since ECMAScript 5
  • How the new class syntax relates to more familiar JavaScript concepts
  • Why iterators and generators are useful
  • How arrow functions are differ from regular functions
  • Additional options for storing data using sets, maps, and more
  • The power of inheriting from native types
  • Why people are so excited about promises for asynchronous programming
  • How modules will change the way you organize code

This book is being developed in the open on GitHub. You can visit the project repo to see the latest updates.

Share this book

Categories

License

Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License

Price

Pick Your Price...

Minimum price

$24.99

$29.99

You pay

$29.99

Author earns

$23.99
$

All prices are in US $. You can pay in US $ or in your local currency when you check out.

EU customers: prices exclude VAT, which is added during checkout.

...Or Buy With Credits!

Number of credits (Minimum 2)

2
The author will earn $24.00 from your purchase!
You can get credits monthly with a Reader Membership

Author

About the Author

Nicholas C. Zakas

Nicholas C. Zakas is an independent software engineer, consultant, coach, and has authored over a dozen books. He created the ESLint open source project and has worked on everything from small websites to massive-scale web applications. He has worked at Box as a principal architect and Yahoo as a presentation architect. Nicholas is a strong advocate for development best practices including progressive enhancement, accessibility, performance, scalability, and maintainability.

Contents

Table of Contents

Introduction

  1. The Road to ECMAScript 6
  2. About This Book
  3. Acknowledgments

Block Bindings

  1. Var Declarations and Hoisting
  2. Block-Level Declarations
  3. Block Binding in Loops
  4. Global Block Bindings
  5. Emerging Best Practices for Block Bindings
  6. Summary

Strings and Regular Expressions

  1. Better Unicode Support
  2. Other String Changes
  3. Other Regular Expression Changes
  4. Template Literals
  5. Summary

Functions

  1. Functions with Default Parameter Values
  2. Working with Unnamed Parameters
  3. Increased Capabilities of the Function Constructor
  4. The Spread Operator
  5. ECMAScript 6’s name Property
  6. Clarifying the Dual Purpose of Functions
  7. Block-Level Functions
  8. Arrow Functions
  9. Tail Call Optimization
  10. Summary

Expanded Object Functionality

  1. Object Categories
  2. Object Literal Syntax Extensions
  3. New Methods
  4. Duplicate Object Literal Properties
  5. Own Property Enumeration Order
  6. More Powerful Prototypes
  7. A Formal Method Definition
  8. Summary

Destructuring for Easier Data Access

  1. Why is Destructuring Useful?
  2. Object Destructuring
  3. Array Destructuring
  4. Mixed Destructuring
  5. Destructured Parameters
  6. Summary

Symbols and Symbol Properties

  1. Creating Symbols
  2. Using Symbols
  3. Sharing Symbols
  4. Symbol Coercion
  5. Retrieving Symbol Properties
  6. Exposing Internal Operations with Well-Known Symbols
  7. Summary

Sets and Maps

  1. Sets and Maps in ECMAScript 5
  2. Problems with Workarounds
  3. Sets in ECMAScript 6
  4. Maps in ECMAScript 6
  5. Summary

Iterators and Generators

  1. The Loop Problem
  2. What are Iterators?
  3. What Are Generators?
  4. Iterables and for-of
  5. Built-in Iterators
  6. The Spread Operator and Non-Array Iterables
  7. Advanced Iterator Functionality
  8. Asynchronous Task Running
  9. Summary

Introducing JavaScript Classes

  1. Class-Like Structures in ECMAScript 5
  2. Class Declarations
  3. Class Expressions
  4. Classes as First-Class Citizens
  5. Accessor Properties
  6. Computed Member Names
  7. Generator Methods
  8. Static Members
  9. Inheritance with Derived Classes
  10. Using new.target in Class Constructors
  11. Summary

Improved Array Capabilities

  1. Creating Arrays
  2. New Methods on All Arrays
  3. Typed Arrays
  4. Similarities Between Typed and Regular Arrays
  5. Differences Between Typed and Regular Arrays
  6. Summary

Promises and Asynchronous Programming

  1. Asynchronous Programming Background
  2. Promise Basics
  3. Global Promise Rejection Handling
  4. Chaining Promises
  5. Responding to Multiple Promises
  6. Inheriting from Promises
  7. Summary

Proxies and the Reflection API

  1. The Array Problem
  2. What are Proxies and Reflection?
  3. Creating a Simple Proxy
  4. Validating Properties Using the set Trap
  5. Object Shape Validation Using the get Trap
  6. Hiding Property Existence Using the has Trap
  7. Preventing Property Deletion with the deleteProperty Trap
  8. Prototype Proxy Traps
  9. Object Extensibility Traps
  10. Property Descriptor Traps
  11. The ownKeys Trap
  12. Function Proxies with the apply and construct Traps
  13. Revocable Proxies
  14. Solving the Array Problem
  15. Using a Proxy as a Prototype
  16. Summary

Encapsulating Code With Modules

  1. What are Modules?
  2. Basic Exporting
  3. Basic Importing
  4. Renaming Exports and Imports
  5. Default Values in Modules
  6. Re-exporting a Binding
  7. Importing Without Bindings
  8. Loading Modules
  9. Summary

Appendix A: Smaller Changes

  1. Working with Integers
  2. New Math Methods
  3. Unicode Identifiers
  4. Formalizing the __proto__ Property

Appendix B: Understanding ECMAScript 7 (2016)

  1. The Exponentiation Operator
  2. The Array.prototype.includes() Method
  3. Change to Function-Scoped Strict Mode

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earned over $14 million writing, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub