Book description
Get up and running with all the new features of ECMAScript and explore new ways of coding with JavaScript.
About This Book
- Grasp the latest features of ECMAScript and the best way to use it in production code
- Learn newly added native APIs to JS Engine and perform tasks efficiently with a cleaner code base
- Understand the more complex sides of JavaScript such as the inheritance model, low-level memory management, multithreaded environments, and web workers
Who This Book Is For
This book is for web developers who have some basic programming knowledge and want to learn to write cleaner code with the power of ECMAScript.
What You Will Learn
- Implement methods associated with objects as per the latest ECMAScript specification
- Make use of the latest features of ECMAScript
- Make use of many new APIs in HTML5 and modern JavaScript implementation
- Use SharedArrayBuffers for superfast concurrent and parallel programming
- Perform asynchronous programming with JavaScript
- Implement the best ways and practices to perform modular programming in JavaScript
In Detail
Learn ECMAScript explores implementation of the latest ECMAScript features to add to your developer toolbox, helping you to progress to an advanced level. Learn to add 1 to a variable andsafely access shared memory data within multiple threads to avoid race conditions.
You'll start the book by building on your existing knowledge of JavaScript, covering performing arithmetic operations, using arrow functions and dealing with closures. Next, you will grasp the most commonly used ECMAScript skills such as reflection, proxies, and classes. Furthermore, you'll learn modularizing the JS code base, implementing JS on the web and how the modern HTML5 + JS APIs provide power to developers on the web. Finally, you will learn the deeper parts of the language, which include making JavaScript multithreaded with dedicated and shared web workers, memory management, shared memory, and atomics. It doesn't end here; this book is 100% compatible with ES.Next.
By the end of this book, you'll have fully mastered all the features of ECMAScript!
Style and approach
The level goes gradually from basic to advanced so that the reader can adapt at every point and level up their skills at the same time. The chapters are carefully arranged in a manner that makes every concept easy to learn and deploy right away in your code.
Table of contents
- Title Page
- Copyright and Credits
- PacktPub.com
- Contributors
- Preface
-
Getting Started with ECMAScript
- The let keyword
- The const keyword
- Immutability in JavaScript
- Default parameter values
- The spread operator
- The rest parameter
- Hoisting
- Destructuring assignments
- Arrow functions
- Enhanced object literals
- Trailing commas and JavaScript
- The semicolon dilemma
- Summary
-
Knowing Your Library
- Working with numbers
- Doing math
-
Arrays
- The Array.from(iterable, mapFunc, this) method
- The Array.of(values…) method
- The fill(value, startIndex, endIndex) method
- The includes() method
- The includes() versus the indexOf() method
- The find(testingFunc) method
- The findIndex(testingFunc) method
- The copyWithin(targetIndex, startIndex, endIndex) function
- The entries(), keys(), and values() methods
- Array iteration
- Collections
- Objects
- Summary
- Using Iterators
- Asynchronous Programming
- Modular Programming
-
Implementing the Reflect API
-
The Reflect object
- The Reflect.apply(function, this, args) method
- The Reflect.construct(constructor, args, prototype) method
- The Reflect.defineProperty(object, property, descriptor) method
- The Reflect.deleteProperty(object, property) method
- The Reflect.get(object, property, this) method
- The Reflect.set(object, property, value, this) method
- The Reflect.getOwnPropertyDescriptor(object, property) method
- The Reflect.getPrototypeOf(object) method
- The Reflect.setPrototypeOf(object, prototype) method
- The Reflect.has(object, property) method
- The Reflect.isExtensible(object) method
- The Reflect.preventExtensions(object) method
- The Reflect.ownKeys(object) method
- Summary
-
The Reflect object
-
Proxies
- Proxies in a nutshell
-
Working with the Proxy API
-
Proxy traps
- The get(target, property, receiver) method
- The set(target, property, value, receiver) method
- The has(target, property) method
- The isExtensible(target) method
- The getPrototypeOf(target) method
- The setPrototypeOf(target, prototype) method
- The preventExtensions(target) method
- The getOwnPropertyDescriptor(target, property) method
- The defineProperty(target, property, descriptor) method
- The deleteProperty(target, property) method
- The ownKeys(target) method
- The apply(target, thisValue, arguments) method
- The construct(target, arguments) method
- The Proxy.revocable(target, handler) method
-
Proxy traps
- The uses of proxies
- Summary
-
Classes
- Understanding object-oriented JavaScript
-
Using classes
- Defining a class
- The class expression
- The prototype methods
- Static methods
- Implementing inheritance in classes
- Computed method names
- The attributes of properties
- Classes are not hoisted!
- Overriding the result of the constructor method
- The Symbol.species static accessor property
- The new.target implicit parameter
- Using super in object literals
- Summary
-
JavaScript on the Web
- HTML5 and the rise of modern JavaScript
-
Modern JavaScript browser APIs
- Page Visibility API - is the user still on the page?
- navigator.onLine API – the user's network status
- Clipboard API - programmatically manipulating the clipboard
- The Canvas API - the web's drawing board
- The Fetch API - promise-based HTTP requests
- Accessing and modifying history with the history API
- Summary
- Storage APIs in JavaScript
-
Web and Service Workers
- An introduction to the concept of threads
- Introduction to web workers
- Checking if worker support is available
- Working with dedicated web workers
- Working with shared workers
- Introduction to inline web workers
- Same origin policy
- Working with service workers
- Summary
-
Shared Memory and Atomics
- Basics of memory
- What is shared memory?
- Understanding parallel programming
-
What are atomics?
- Information about lock and mutex
-
Atomics in JavaScript
- Using the Atomics.load(typedArray, index) method
- Using the Atomics.add(typedArray, index, value) method
- Using the Atomics.sub(typedArray, index, value) method
- Using the Atomics.and(typedArray, index, value) method
- Using the Atomics.or(typedArray, index, value) method
- Using the Atomics.xor(typedArray, index, value) method
- Fixing one billion count with atomics
- A peek into Spectre
- Summary
- Other Books You May Enjoy
Product information
- Title: Learn ECMAScript - Second Edition
- Author(s):
- Release date: February 2018
- Publisher(s): Packt Publishing
- ISBN: 9781788620062
You might also like
book
JavaScript Next: Your Complete Guide to the New Features Introduced in JavaScript, Starting from ES6 to ES9
JavaScript has finally grown up. Armed with a slew of new features, JavaScript now makes writing …
book
ECMAScript Cookbook
Become a better web programmer by writing efficient and modular code using ES6 and ES8 About …
book
Pro JavaScript Performance: Monitoring and Visualization
Performance is a hugely important area of web development. If your site runs slowly, users are …
book
JavaScript
All of JavaScript's newest features, in depth, made easy to understand. JavaScript is a rapidly changing …