---
title: "ES2019 Features"
description: "A comprehensive overview of all ES2019 JavaScript features. Practical notes and code examples on ES2019 Features by Hemanth."
url: "https://h3manth.com/scribe/es2019-features/"
canonical_url: "https://h3manth.com/scribe/es2019-features/"
markdown_url: "https://h3manth.com/scribe/blog/es2019-features.md"
publishDate: "2019-02-06T00:00:00.000Z"
author: "Hemanth HM"
category: "javascript"
tags: ["javascript","es2019","tc39"]
word_count: 253
reading_time_minutes: 2
x_markdown_tokens: 506
content_signal: "ai-train=yes, search=yes, ai-input=yes"
---

# ES2019 Features

> A comprehensive overview of all ES2019 JavaScript features. Practical notes and code examples on ES2019 Features by Hemanth.

It's time for another post, this time ES2019 features. Here are all the features and examples:

## Array#{flat,flatMap}

```javascript
[1, 2, 3].flatMap((x) => [x, x * 2]);
// => [1, 2, 2, 4, 3, 6]

[1, [2, [3]]].flat(Infinity);
// => [1, 2, 3]

## Object.fromEntries
javascript
const iterableOfEntries = new Map([
  ['cat', 'dog'],
  ['life', 42]
]);

const obj = Object.fromEntries(iterableOfEntries);
console.log(obj); // { cat: "dog", life: 42 }

## String#{trimStart,trimEnd}
javascript
"  Hey JS!".trimStart(); // "Hey JS!"
"Hey JS!  ".trimEnd();   // "Hey JS!"

## Symbol#description
javascript
const symbol = Symbol('TC39');
console.log(symbol.description); // 'TC39'
console.log(symbol.hasOwnProperty('description')); // false

## Optional Catch Binding
javascript
try {
  throw new Error("End of life!");
} catch { // ✋ no params for catch
  console.log("^ you are dead anyway!");
}

## JSON ⊂ ECMAScript
javascript
// Without the proposal:
"foo<U+2028>bar<U+2029>baz" // → SyntaxError

// With the proposal:
"foo<U+2028>bar<U+2029>baz" // does not throw

## Well-formed JSON.stringify
javascript
JSON.stringify('\uD800');
// → '"\\ud800"'

## Function#toString
javascript
function /* this is bar */ bar () {}
bar.toString();
// 'function /* this is bar */ bar () {}'
// ^ previously this was not the case

## Array#sort Stability
javascript
[
  { name: "Jan", age: 20 },
  { name: "Jhon", age: 20 },
  { name: "David", age: 18 },
  { name: "Ram", age: 18 },
  { name: "Sita", age: 18 },
  { name: "Ravan", age: 18 },
  { name: "Asura", age: 12 },
  { name: "Milly", age: 12 },
].sort((m, n) => m.age - n.age);
// People with the same age retain their order.
```
