mirror of
https://github.com/alrayyes/wiki.git
synced 2024-11-21 19:16:23 +00:00
915 B
915 B
date | id | title |
---|---|---|
2020-10-26 | 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