mirror of
https://github.com/alrayyes/wiki.git
synced 2024-11-29 06:26:22 +00:00
898 B
898 B
id | title |
---|---|
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