Exploring ES6
Exploring ES6
Upgrade to the next version of JavaScript
About the Book
- Complete contents of this book: http://exploringjs.com/es6/
- Homepage with various resources: http://exploringjs.com/es6.html
Bundles that include this book
Table of Contents
-
-
What you need to know about this book
- Audience: JavaScript programmers
- Why should I read this book?
- How to read this book
- Sources of this book
- Glossary
- Conventions
- Demo code on GitHub
- Sidebars
- Footnotes
- Foreword
- Preface
- Acknowledgements
- About the author
-
What you need to know about this book
-
I Background
-
1. About ECMAScript 6 (ES6)
- 1.1 TC39 (Ecma Technical Committee 39)
- 1.2 How ECMAScript 6 was designed
- 1.3 JavaScript versus ECMAScript
- 1.4 Upgrading to ES6
- 1.5 Goals for ES6
- 1.6 Categories of ES6 features
- 1.7 A brief history of ECMAScript
-
2. FAQ: ECMAScript 6
- 2.1 How can I use ES6 today?
- 2.2 Isn’t ECMAScript 6 now called ECMAScript 2015?
- 2.3 How do I migrate my ECMAScript 5 code to ECMAScript 6?
- 2.4 Does it still make sense to learn ECMAScript 5?
- 2.5 Is ES6 bloated?
- 2.6 Isn’t the ES6 specification very big?
- 2.7 Does ES6 have array comprehensions?
- 2.8 Is ES6 statically typed?
-
3. One JavaScript: avoiding versioning in ECMAScript 6
- 3.1 Versioning
- 3.2 Strict mode and ECMAScript 6
- 3.3 Breaking changes in ES6
- 3.4 Conclusion
- 3.5 Further reading
-
4. Core ES6 features
-
4.1 From
var
toconst
/let
- 4.2 From IIFEs to blocks
- 4.3 From concatenating strings to template literals
- 4.4 From function expressions to arrow functions
- 4.5 Handling multiple return values
-
4.6 From
for
toforEach()
tofor-of
- 4.7 Handling parameter default values
- 4.8 Handling named parameters
-
4.9 From
arguments
to rest parameters -
4.10 From
apply()
to the spread operator (...
) -
4.11 From
concat()
to the spread operator (...
) - 4.12 From function expressions in object literals to method definitions
- 4.13 From constructors to classes
-
4.14 From custom error constructors to subclasses of
Error
- 4.15 From objects to Maps
- 4.16 New string methods
- 4.17 New Array methods
- 4.18 From CommonJS modules to ES6 modules
- 4.19 What to do next
-
4.1 From
-
1. About ECMAScript 6 (ES6)
-
II Data
-
5. New number and
Math
features- 5.1 Overview
- 5.2 New integer literals
-
5.3 New static
Number
properties -
5.4 New
Math
functionality - 5.5 FAQ: numbers
-
6. New string features
- 6.1 Overview
- 6.2 Unicode code point escapes
- 6.3 String interpolation, multi-line string literals and raw string literals
- 6.4 Iterating over strings
- 6.5 Numeric values of code points
- 6.6 Checking for inclusion
- 6.7 Repeating strings
- 6.8 String methods that delegate regular expression work to their parameters
- 6.9 Reference: the new string methods
-
7. Symbols
- 7.1 Overview
- 7.2 A new primitive type
- 7.3 Using symbols to represent concepts
- 7.4 Symbols as keys of properties
- 7.5 Converting symbols to other primitive types
- 7.6 Wrapper objects for symbols
- 7.7 Crossing realms with symbols
- 7.8 FAQ: symbols
-
7.9 The spelling of well-known symbols: why
Symbol.iterator
and notSymbol.ITERATOR
(etc.)? - 7.10 The symbol API
-
8. Template literals
- 8.1 Overview
- 8.2 Introduction
- 8.3 Examples of using tagged template literals
- 8.4 Implementing tag functions
- 8.5 FAQ: template literals and tagged template literals
-
9. Variables and scoping
- 9.1 Overview
-
9.2 Block scoping via
let
andconst
-
9.3
const
creates immutable variables - 9.4 The temporal dead zone
-
9.5
let
andconst
in loop heads - 9.6 Parameters as variables
- 9.7 The global object
- 9.8 Function declarations and class declarations
-
9.9 Coding style:
const
versuslet
versusvar
-
10. Destructuring
- 10.1 Overview
- 10.2 Background: Constructing data versus extracting data
- 10.3 Patterns for destructuring
- 10.4 How do patterns access the innards of values?
- 10.5 Default values
- 10.6 More object destructuring features
- 10.7 More Array destructuring features
- 10.8 You can assign to more than just variables
- 10.9 Pitfalls of destructuring
- 10.10 Examples of destructuring
- 10.11 The destructuring algorithm
-
11. Parameter handling
- 11.1 Overview
- 11.2 Parameter handling as destructuring
- 11.3 Parameter default values
- 11.4 Rest parameters
- 11.5 Simulating named parameters
- 11.6 Examples of destructuring in parameter handling
- 11.7 Coding style tips
-
11.8 The spread operator (
...
)
-
5. New number and
-
III Modularity
-
12. Callable entities in ECMAScript 6
- 12.1 Overview
- 12.2 Ways of calling in ES6
- 12.3 Recommendations for using callable entities
- 12.4 ES6 callable entities in detail
- 12.5 Dispatched and direct method calls in ES5 and ES6
-
12.6 The
name
property of functions - 12.7 FAQ: callable entities
-
13. Arrow functions
- 13.1 Overview
-
13.2 Traditional functions are bad non-method functions, due to
this
- 13.3 Arrow function syntax
- 13.4 Lexical variables
- 13.5 Syntax pitfalls
- 13.6 Immediately-invoked arrow functions
-
13.7 Arrow functions versus
bind()
- 13.8 Arrow functions versus normal functions
- 13.9 FAQ: arrow functions
-
14. New OOP features besides classes
- 14.1 Overview
- 14.2 New features of object literals
-
14.3 New methods of
Object
- 14.4 Traversing properties in ES6
- 14.5 Assigning versus defining properties
-
14.6
__proto__
in ECMAScript 6 - 14.7 Enumerability in ECMAScript 6
- 14.8 Customizing basic language operations via well-known symbols
- 14.9 FAQ: object literals
-
15. Classes
- 15.1 Overview
- 15.2 The essentials
- 15.3 Private data for classes
- 15.4 Simple mixins
- 15.5 The details of classes
- 15.6 The details of subclassing
- 15.7 The species pattern
- 15.8 The pros and cons of classes
- 15.9 FAQ: classes
- 15.10 What is next for classes?
- 15.11 Further reading
-
16. Modules
- 16.1 Overview
- 16.2 Modules in JavaScript
- 16.3 The basics of ES6 modules
- 16.4 Importing and exporting in detail
- 16.5 The ECMAScript 6 module loader API
- 16.6 Using ES6 modules in browsers
- 16.7 Details: imports as views on exports
- 16.8 Design goals for ES6 modules
- 16.9 FAQ: modules
- 16.10 Advantages of ECMAScript 6 modules
- 16.11 Further reading
-
12. Callable entities in ECMAScript 6
-
IV Collections
-
17. The
for-of
loop- 17.1 Overview
-
17.2 Introducing the
for-of
loop -
17.3 Pitfall:
for-of
only works with iterable values -
17.4 Iteration variables:
const
declarations versusvar
declarations - 17.5 Iterating with existing variables, object properties and Array elements
- 17.6 Iterating with a destructuring pattern
-
18. New Array features
- 18.1 Overview
-
18.2 New static
Array
methods -
18.3 New
Array.prototype
methods - 18.4 ES6 and holes in Arrays
-
18.5 Configuring which objects are spread by
concat()
(Symbol.isConcatSpreadable
) - 18.6 The numeric range of Array indices
-
19. Maps and Sets
- 19.1 Overview
- 19.2 Map
- 19.3 WeakMap
- 19.4 Set
- 19.5 WeakSet
- 19.6 FAQ: Maps and Sets
-
20. Typed Arrays
- 20.1 Overview
- 20.2 Introduction
- 20.3 ArrayBuffers
- 20.4 Typed Arrays
- 20.5 DataViews
- 20.6 Browser APIs that support Typed Arrays
- 20.7 Extended example: JPEG SOF0 decoder
- 20.8 Availability
-
21. Iterables and iterators
- 21.1 Overview
- 21.2 Iterability
- 21.3 Iterable data sources
- 21.4 Iterating language constructs
- 21.5 Implementing iterables
- 21.6 More examples of iterables
- 21.7 FAQ: iterables and iterators
- 21.8 The ECMAScript 6 iteration protocol in depth
-
22. Generators
- 22.1 Overview
- 22.2 What are generators?
- 22.3 Generators as iterators (data production)
- 22.4 Generators as observers (data consumption)
- 22.5 Generators as coroutines (cooperative multitasking)
- 22.6 Examples of generators
- 22.7 Inheritance within the iteration API (including generators)
- 22.8 Style consideration: whitespace before and after the asterisk
- 22.9 FAQ: generators
- 22.10 Conclusion
- 22.11 Further reading
-
17. The
-
V Standard library
-
23. New regular expression features
- 23.1 Overview
-
23.2 New flag
/y
(sticky) -
23.3 New flag
/u
(unicode) -
23.4 New data property
flags
-
23.5
RegExp()
can be used as a copy constructor - 23.6 String methods that delegate to regular expression methods
-
24. Asynchronous programming (background)
- 24.1 The JavaScript call stack
- 24.2 The browser event loop
- 24.3 Receiving results asynchronously
- 24.4 Looking ahead
- 24.5 Further reading
-
25. Promises for asynchronous programming
- 25.1 Overview
- 25.2 Introduction: Promises
- 25.3 A first example
- 25.4 Three ways of understanding Promises
- 25.5 Creating and using Promises
- 25.6 Examples
- 25.7 Other ways of creating Promises
- 25.8 Chaining Promises
- 25.9 Common Promise chaining mistakes
- 25.10 Tips for error handling
- 25.11 Composing Promises
- 25.12 Two useful additional Promise methods
- 25.13 Node.js: using callback-based sync functions with Promises
- 25.14 ES6-compatible Promise libraries
- 25.15 Next step: using Promises via generators
- 25.16 Promises in depth: a simple implementation
- 25.17 Advantages and limitations of Promises
- 25.18 Reference: the ECMAScript 6 Promise API
- 25.19 Further reading
-
23. New regular expression features
-
VI Miscellaneous
-
26. Unicode in ES6
- 26.1 Unicode is better supported in ES6
- 26.2 Escape sequences in ES6
-
27. Tail call optimization
- 27.1 What is tail call optimization?
- 27.2 Checking whether a function call is in a tail position
- 27.3 Tail-recursive functions
-
28. Metaprogramming with proxies
- 28.1 Overview
- 28.2 Programming versus metaprogramming
- 28.3 Proxies explained
- 28.4 Use cases for proxies
- 28.5 The design of the proxy API
- 28.6 FAQ: proxies
- 28.7 Reference: the proxy API
- 28.8 Conclusion
- 28.9 Further reading
- 29. Coding style tips for ECMAScript 6
-
30. An overview of what’s new in ES6
- 30.1 Categories of ES6 features
-
30.2 New number and
Math
features - 30.3 New string features
- 30.4 Symbols
- 30.5 Template literals
- 30.6 Variables and scoping
- 30.7 Destructuring
- 30.8 Parameter handling
- 30.9 Callable entities in ECMAScript 6
- 30.10 Arrow functions
- 30.11 New OOP features besides classes
- 30.12 Classes
- 30.13 Modules
-
30.14 The
for-of
loop - 30.15 New Array features
- 30.16 Maps and Sets
- 30.17 Typed Arrays
- 30.18 Iterables and iterators
- 30.19 Generators
- 30.20 New regular expression features
- 30.21 Promises for asynchronous programming
- 30.22 Metaprogramming with proxies
-
26. Unicode in ES6
- Notes
Authors have earned$10,052,337writing, publishing and selling on Leanpub, earning 80% royalties while saving up to 25 million pounds of CO2 and up to 46,000 trees.
Learn more about writing on Leanpub
The Leanpub 45-day 100% Happiness Guarantee
Within 45 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms
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), EPUB (for phones and tablets) and MOBI (for 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
Top Books
C++ Best Practices
Jason TurnerLevel up your C++, get the tools working for you, eliminate common problems, and move on to more exciting things!
Digital-First Events
Joep Piscaer and Jana BorutaThe only resource you will ever need to launch your digital events program.
Algebra-Driven Design
Sandy MaguireA how-to field guide on building leak-free abstractions and algebraically designing real-world applications.
Ansible for DevOps
Jeff GeerlingAnsible is a simple, but powerful, server and configuration management tool. Learn to use Ansible effectively, whether you manage one server—or thousands.
R Programming for Data Science
Roger D. PengThis book brings the fundamentals of R programming to you, using the same material developed as part of the industry-leading Johns Hopkins Data Science Specialization. The skills taught in this book will lay the foundation for you to begin your journey learning data science. Printed copies of this book are available through Lulu.
Continuous Delivery Pipelines
Dave FarleyThis practical handbook provides a step-by-step guide for you to get the best continuous delivery pipeline for your software.
Cloud Strategy
Gregor Hohpe“Strategy is the difference between making a wish and making it come true.” A successful migration to the cloud can transform your organization, but it shouldn’t be driven by wishes. This book tells you how to develop a sound strategy guided by frameworks and decision models without being overly abstract nor getting lost in product details.
node-opcua by example
Etienne RossignonGet the best out of node-opcua through a set of documented examples by the author himself that will allow you to create stunning OPCUA Servers or Clients.
Technical leadership and the balance with agility
Simon BrownA developer-friendly, practical and pragmatic guide to lightweight software architecture, technical leadership and the balance with agility.
Everyday Rails - RSpecによるRailsテスト入門
Junichi Ito (伊藤淳一), AKIMOTO Toshiharu, 魚振江, and Aaron SumnerRSpecを使ってRailsアプリケーションに信頼性の高いテストを書く実践的なアドバイスを提供します。詳細で丁寧な説明は本書のオリジナルコンテンツです。また、説明には実際に動かせるサンプルアプリケーションも使用します。本書は2017年版にアップデートされ、RSpec 3.6やRails 5.1といった新しい環境に対応しています!さあ、自信をもってテストできるようになりましょう!
Top Bundles
- #1
Software Architecture for Developers: Volumes 1 & 2 - Technical leadership and communication
2 Books
"Software Architecture for Developers" is a practical and pragmatic guide to modern, lightweight software architecture, specifically aimed at developers. You'll learn:The essence of software architecture.Why the software architecture role should include coding, coaching and collaboration.The things that you really need to think about before... - #2
CCIE Service Provider Ultimate Study Bundle
2 Books
Piotr Jablonski, Lukasz Bromirski, and Nick Russo have joined forces to deliver the only CCIE Service Provider training resource you'll ever need. This bundle contains a detailed and challenging collection of workbook labs, plus an extensively detailed technical reference guide. All of us have earned the CCIE Service Provider certification... - #3
Modern C++ by Nicolai Josuttis
2 Books
- #4
Django for Beginners/APIs/Professionals
3 Books
- #5
Modern Management Made Easy
3 Books
Read all three Modern Management Made Easy books. Learn to manage yourself, lead and serve others, and lead the organization. - #6
Cisco CCNA 200-301 Complet
4 Books
Ce lot comprend les quatre volumes du guide préparation à l'examen de certification Cisco CCNA 200-301. - #7
Mastering Containers
2 Books
Docker and Kubernetes are taking the world by storm! These books will get you up-to-speed fast! Docker Deep Dive is over 400 pages long, and covers all objectives on the Docker Certified Associate exam.The Kubernetes Book includes everything you need to get up and running with Kubernetes! - #8
The Python Craftsman
3 Books
The Python Craftsman series comprises The Python Apprentice, The Python Journeyman, and The Python Master. The first book is primarily suitable for for programmers with some experience of programming in another language. If you don't have any experience with programming this book may be a bit daunting. You'll be learning not just a programming... - #9
CCDE Practical Studies (All labs)
3 Books
CCDE lab - #10
Linux Administration Complet
4 Books
Ce lot comprend les quatre volumes du Guide Linux Administration :Linux Administration, Volume 1, Administration fondamentale : Guide pratique de préparation aux examens de certification LPIC 1, Linux Essentials, RHCSA et LFCS. Administration fondamentale. Introduction à Linux. Le Shell. Traitement du texte. Arborescence de fichiers. Sécurité...