Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
ECMAScript Cookbook

You're reading from   ECMAScript Cookbook Over 70 recipes to help you learn the new ECMAScript (ES6/ES8) features and solve common JavaScript problems

Arrow left icon
Product type Paperback
Published in Mar 2018
Publisher Packt
ISBN-13 9781788628174
Length 348 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Ross Harrison Ross Harrison
Author Profile Icon Ross Harrison
Ross Harrison
Arrow right icon
View More author details
Toc

Table of Contents (14) Chapters Close

Preface 1. Building with Modules FREE CHAPTER 2. Staying Compatible with Legacy Browsers 3. Working with Promises 4. Working with async/await and Functions 5. Web Workers, Shared Memory, and Atomics 6. Plain Objects 7. Creating Classes 8. Inheritance and Composition 9. Larger Structures with Design Patterns 10. Working with Arrays 11. Working with Maps and Symbols 12. Working with Sets 13. Other Books You May Enjoy

What this book covers

Chapter 1, Building with Modules, covers how to use ECMAScript modules to organize code and how to configure modern browsers to use them. This chapter also covers compatibility with Google's Chrome and Mozilla's Firefox browser, and how to make them work with modules.

Chapter 2, Staying Compatible with Legacy Browsers, covers how to convert code that uses ECMAScript modules into a format that can be used by platforms that don't support them. We use webpack, a common JavaScript compilation tool, to assemble our modules into a single JavaScript file (called a bundle) and load it into our browser when ECMASript modules aren't compatible.

 Chapter 3, Working with Promises, covers how to use the Promise API to organize asynchronous programs. We'll take a look at how to propagate results through promise chains and handle errors. Promises are generally regarded as an improvement over the older callback pattern. This chapter also lays a foundation for the topic covered in the next chapter.

Chapter 4, Working with async/await and Functions, covers how to use the new async and await features. Building on the preceding chapter, we'll take a look at how they can be replaced or used in concert with the Promise API, improving program readability while maintaining compatibility.

Chapter 5, Web Workers, Shared Memory, and Atomics, covers the web APIs that can be used to process data in parallel. This chapter is emblematic for the recent development of JavaScript as a language and web browsers as platforms. Parallel programming is a new domain for JavaScript that brings new possibilities and problems to the language.

Chapter 6, Plain Objects, demonstrates the use of API and syntax options to work with plain objects. We'll look at how to work with objects as a collection and how to define properties with some interesting behaviors.

Chapter 7, Creating Classes, covers the use of ECMAScript class semantics. We'll create new classes with behaviors that are defined on single instances and whole classes. We'll take a look at how to add properties and define methods.

Chapter 8, Inheritance and Composition, builds on our knowledge from the preceding chapter; we'll combine classes into larger structures. We'll also take a look at how to use both composition and inheritance to share behaviors between classes, and we'll discuss the benefits and drawbacks of each.

Chapter 9, Larger Structures with Design Patterns, further expanding on the prior two chapters, looks at some common ways that programs are organized for certain tasks. We'll implement some common design patterns and demonstrate how we can expand and modify them for different uses.

Chapter 10, Working with Arrays, covers the use of the new Array API features. In the past, working with arrays meant a lot of loops and keeping track of indices, or importing bulky libraries to clean repeated code. This chapter will show some new, functionally inspired, methods that make working with these collections much easier.

 Chapter 11, Working with Maps and Symbols, covers how to make use of the  Map and WeakMap classes to create relationships between different kinds of values. In this chapter, we'll look at how to use the APIs of these two classes, how they are different, and how we can control which types go into them.

Chapter 12, Working with Sets, demonstrates the use of the Set and WeakSet classes. These classes are excellent when the order of elements doesn't matter, and we just want to is something exists. We'll see how to use the APIs of these two classes, when to use one over the other, and how we can control what types go into them.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime