wiki/content/20201026104538-es2017.md

913 B

date id title
20201026 d773822a-2ab2-4661-b5fa-8e16c5fe0dc4 ES2017

Description

What's new in ES2017

Async functions

Fulfilling a promise

async function asyncFunc() {
  return 123;
}

asyncFunc().then((x) => console.log(x));
// 123

Rejecting a promise

async function asyncFunc() {
  throw new Error("Problem!");
}

asyncFunc().catch((err) => console.log(err));
// Error: Problem!

Object functions

String methods

Pads the beginning of a string