Sitemap
Better Programming

Advice for programmers.

JavaScript ES2020 Features With Simple Examples

The latest in JavaScript

4 min readJan 5, 2020

--

Press enter or click to view image in full size
Image
Photo by AbsolutVision on Unsplash

Today, we’re going to look at ECMAScript features from 2015:

Introduction

ES2020 is the version of ECMAScript corresponding to the year 2020. This version doesn’t include as many new features as those that appeared in ES6 (2015). However, some useful features have been incorporated.

This article introduces the features provided by ES2020 in easy code examples. In this way, you can quickly understand the new features without the need for a complex explanation.

Of course, it’s necessary to have a basic knowledge of JavaScript to fully understand the best ones introduced.

The new JavaScript features in ES2020 are:

➡️ String.prototype.matchAll
➡️ import()
➡️ BigInt
➡️ Promise.allSettled
➡️ globalThis
➡️ for-in mechanics
➡️ Optional Chaining
➡️ Nullish coalescing Operator

String.protype.matchAll

The matchAll() method returns an iterator of all results matching a string against a regular expression, including capturing groups.

Press enter or click to view image in full size
Image

Dynamic Import

Dynamic import() returns a promise for the module namespace object of the requested module. Therefore, imports can now be assigned to a variable using async/await.

Press enter or click to view image in full size
Image

BigInt — Arbitrary Precision Integers

--

--

Carlos Caballero
Carlos Caballero

Written by Carlos Caballero

Hi! My name is Carlos Caballero and I’m PhD. in Computer Science from Málaga, Spain. Teaching developers and degree/master computer science how to be experts!

Responses (6)