Get Programming with JavaScript Next
New features of ECMAScript 2015, 2016, and beyond
JD Isaacks
  • April 2018
  • ISBN 9781617294204
  • 376 pages
  • printed in black & white

A great resource to quickly get up to speed on everything ES6 and beyond. Everything you need, nothing you don't!

Mike Jensen, UrbanStems

Get Programming with JavaScript Next introduces the modern age of JavaScript programming with ES6 and ES7 without dragging you through confusing jargon and abstract examples you'll never use. In just 34 quick-fire sessions, you'll quickly be coding with the latest features and functions of ES6 and ES7!

Table of Contents detailed table of contents

Front matter




About this book

Who should read this book

How this book is organized

About the code

Book forum

Online resources

About the author

Unit 0: Getting Setup

1 ECMAScript specification and the proposal process

1.1 A brief history of ECMAScript

1.2 Why ES2015 adds so much

1.3 Who decides what gets added?

1.3.1 Specification stages

1.3.2 Picking a stage

1.4 What this book will cover

1.5 Summary

2 Transpiling with Babel

2.1 What is transpiling?

2.1.1 Compiling to JavaScript languages

2.1.2 Where Babel fits in

2.2 Setting up Babel 6

2.3 The Babel configuration needed for this book

2.3.1 A note on source maps

2.3.2 Set up Babel as NPM script

2.4 Summary

3 Bundling modules with Browserify

3.1 What is a module?

3.2 How modules work in Node.js

3.3 What is Browserify?

3.4 How does Browserify help with ES6 modules?

2.5 Setting up Browserify with Babel

3.5.1 Install Browserify

3.5.2 Setting up a project using Babelify

3.6 Alternatives to Browserify

3.7 Summary

Unit 1: Variables and strings

4 Declaring variables with let

4.1 How scope works with let

4.1.1 Why the block scope of let is preferred

4.2 How hoisting works with let

4.3 Should I use let instead of var from now on?

4.4 Summary

4.5 Quick check answers

5 Declaring constants with const

5.1 How constants work

5.2 When to use constants

5.3 Summary

5.4 Quick check answers

6 New string methods

6.1 Searching strings

6.2 Padding strings

6.3 Summary

6.4 Quick check answers

7 Template literals

7.1 What are template literals?

7.1.1 String interpolation with template literals

7.1.2 Multiline strings with template literals

7.2 Template literals are not reusable templates

7.3 Custom processing with tagged template literals

7.4 Summary

7.5 Quick check answers

8 Capstone: Building a domain-specific language

8.1 Create some helper functions

8.2 Create an HTML-escaping DSL

8.3 Create a DSL for converting arrays into HTML

8.4 Summary

Unit 2: Objects and arrays

9 New array methods

9.1 Constructing arrays with Array.from

9.2 Constructing arrays with Array.of

9.3 Constructing Arrays with Array.prototype.fill

9.4 Searching in arrays with Array.prototype.includes

9.5 Searching in arrays with Array.prototype.find

9.6 Summary

9.7 Quick check answers

10 Object.assign

10.1 Setting default values with Object.assign

10.2 Extending objects with Object.assign

10.3 Preventing mutations when using Object.assign

10.4 How Object.assign assigns values

10.5 Summary

10.6 Quick check answers

11 Destructuring

11.1 Destructuring objects

11.2 Destructuring arrays

11.3 Combining array and object destructuring

11.4 What types can be destructured

11.5 Summary

11.6 Quick check answers

12 New object literal syntax

12.1 Shorthand property names

12.2 Shorthand method names

12.3 Computed property names

12.4 Summary

12.5 Quick check answers

13 Symbol—​a new primitive

13.1 Using symbols as constants

13.2 Using symbols as object keys

13.3 Creating behavior hooks with global symbols

13.4 Modifying object behavior with well-known symbols

13.5 Symbol gotchas

13.6 Summary

13.7 Quick check answers

14 Capstone: Simulating a lock and key

14.1 Creating the lock and key system

14.2 Creating a Choose the Door game

14.3 Summary

Unit 3: Functions

15 Default parameters and rest

15.1 Default parameters

15.2 Using default params to skip recalculating values

15.3 Gathering parameters with the rest operator

15.4 Using rest to pass arguments between functions

15.5 Summary

15.6 Quick check answers

16 Destructuring parameters

16.1 Destructuring array parameters

16.2 Destructuring object parameters

16.3 Simulating named parameters

16.4 Creating aliased parameters

16.5 Summary

16.6 Quick check answers

17 Arrow functions

17.1 Succinct code with arrow functions

17.2 Maintaining context with arrow functions

17.3 Arrow function gotchas

17.4 Summary

17.5 Quick check answers

18 Generator functions

18.1 Defining generator functions

18.2 Using generator functions

18.3 Creating infinite lists with generator functions

18.4 Summary

18.5 Quick Check Answers

19 Capstone: The prisoner’s dilemma

19.1 Generating prisoners

19.2 Getting prisoners To interact

19.3 Getting and storing the results

19.4 Putting the simulation together

19.5 Which prisoner does best?

19.6 Summary

Unit 4: Modules

20 Creating modules

20.1 Module rules

20.2 Creating modules

20.3 When does a JavaScript file become a module?

20.4 Summary

20.5 Quick check answers

21 Using modules

21.1 Specifying a module’s location

21.2 Importing values from modules

21.3 How imported values are bound

21.4 Importing side effects

21.5 Breaking apart and organizing modules

21.6 Summary

21.7 Quick check answers

22 Capstone: Hangman game

22.1 Planning

22.2 The words module

22.3 The status module

22.4 The game’s interface modules

22.5 The index

22.6 Summary

Unit 5: Iterables

23 Iterables

23.1 Iterables—​what are they?

23.2 The for..of statement

23.3 Spread

23.3.1 Using spread as an immutable push

23.4 Iterators—​looking under the hood of iterables

23.5 Summary

23.6 Quick check answers

24 Sets

24.1 Creating sets

24.2 Using sets

24.3 What about the WeakSet?

24.4 Summary

24.5 Quick check answers

25 Maps

25.1 Creating maps

25.2 Using maps

25.3 When to use maps

25.4 What about the WeakMap?

25.5 Summary

25.6 Quick check answers

26 Capstone: Blackjack

26.1 The cards and the deck

26.2 Making the CPU’s turn slow enough to see

26.3 Putting the pieces together

26.4 Summary

Unit 6: Classes

27 Classes

27.1 Class declarations

27.2 Instantiating classes

27.3 Exporting classes

27.4 Class methods are not bound

27.5 Setting instance properties in class definition

27.6 Static properties

27.7 Summary

27.8 Quick check answers

28 Extending classes

28.1 Extends

28.2 Super

28.3 A common gotcha when extending classes

28.4 Summary

28.5 Quick check answers

29 Capstone: Comets

29.1 Creating a controllable sprite

29.2 Adding comets

29.3 Shooting rockets

29.4 When things collide

29.5 Adding explosions

29.6 Summary

Unit 7: Working asynchronously

30 Promises

30.1 Using promises

30.2 Error handling

30.3 Promise helpers

30.4 Summary

30.5 Quick check answers

31 Advanced promises

31.1 Creating promises

31.2 Nested promises

31.3 Catching errors

31.4 Summary

31.5 Quick check answers

32 Async functions

32.1 Asynchronous code with generators

32.2 Async functions

32.3 Error handling in async functions

32.4 Summary

32.5 Quick check answers

33 Observables

33.1 Creating observables

33.2 Composing observables

33.3 Creating observable combinators

33.4 Summary

33.5 Quick check answers

34 Canvas image gallery

34.1 Fetching images

34.2 Painting the images on the canvas

34.3 Repeating the process

34.4 Summary


A Exercise answers

Lesson 4

Lesson 5

Lesson 6

Lesson 7

Lesson 9

Lesson 10

Lesson 11

Lesson 12

Lesson 13

Lesson 15

Lesson 16

Lesson 17

Lesson 18

Lesson 20

Lesson 21

Lesson 23

Lesson 24

Lesson 25

Lesson 27

Lesson 28

Lesson 30

Lesson 31

Lesson 32

Lesson 33

About the Technology

Great code is readable, bug-free, and maintainable. Modern JavaScript, aka JavaScript Next, makes it much, much easier to write great applications. New features introduced in ES2015 simplify the structure of your JavaScript projects and radically streamline async-oriented tasks like writing reactive applications and microservices.

About the book

Get Programming with JavaScript Next introduces you to the new features included in the ES2015-and-later JavaScript releases. You'll learn example by example in 34 short lessons, each designed to drive home a specific skill. The coverage is complete: you'll explore new language syntax, declarations, and data types. You'll structure code with modules, replace callbacks with promises, and use classes instead of constructors. Every time you turn a page, complete an exercise, or study a carefully crafted illustration, you'll be one step closer to JavaScript mastery.

What's inside

  • New features from ES2015 and later
  • Writing asynchronous code
  • Creating custom iterables
  • Troubleshooting modules and classes

About the reader

Written for web developers comfortable with standard JavaScript 5 features and coding style.

About the author

J.D. Isaacks is a seasoned developer, a JavaScript instructor, and an open source maintainer.

Get Programming with JavaScript Next (combo) added to cart
continue shopping
go to cart

combo $39.99 pBook + eBook + liveBook
Get Programming with JavaScript Next (eBook) added to cart
continue shopping
go to cart

eBook $31.99 pdf + ePub + kindle + liveBook

FREE domestic shipping on three or more pBooks

A must-read for JS developers who want to be more productive by using the features and functionality of the new ECMAScript.

Ali Naqvi, IBM

The language has evolved, and with this book you're ready to evolve with it.

Ethien Daniel Salinas Dominguez, Creze

The most comprehensive content that I have seen on JavaScript Next. Highly recommended.

Matteo Gildone, Springer Nature