Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying ECMAScript Cookbook
  • Table Of Contents Toc
  • Feedback & Rating feedback
ECMAScript Cookbook

ECMAScript Cookbook

By : Harrison
4.3 (3)
close
close
ECMAScript Cookbook

ECMAScript Cookbook

4.3 (3)
By: Harrison

Overview of this book

ECMAScript Cookbook follows a modular approach with independent recipes covering different feature sets and specifications of ECMAScript to help you become an efficient programmer. This book starts off with organizing your JavaScript applications as well as delivering those applications to modem and legacy systems. You will get acquainted with features of ECMAScript 8 such as async, SharedArrayBuffers, and Atomic operations that enhance asynchronous and parallel operations. In addition to this, this book will introduce you to SharedArrayBuffers, which allow web workers to share data directly, and Atomic operations, which help coordinate behavior across the threads. You will also work with OOP and Collections, followed by new functions and methods on the built-in Object and Array types that make common operations more manageable and less error-prone. You will then see how to easily build more sophisticated and expressive program structures with classes and inheritance. In the end, we will cover Sets, Maps, and Symbols, which are the new types introduced in ECMAScript 6 to add new behaviors and allow you to create simple and powerful modules. By the end of the book, you will be able to produce more efficient, expressive, and simpler programs using the new features of ECMAScript. ?
Table of Contents (14 chapters)
close
close

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.

Unlock full access

Continue reading for free

A Packt free trial gives you instant online access to our library of over 7000 practical eBooks and videos, constantly updated with the latest in tech

Create a Note

Modal Close icon
You need to login to use this feature.
notes
bookmark search playlist download font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Delete Note

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Edit Note

Modal Close icon
Write a note (max 255 characters)
Cancel
Update Note

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY