mirror of
https://github.com/alrayyes/wiki.git
synced 2024-11-22 11:36:23 +00:00
913 B
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