wiki/content/20201026104538-es2017.md

47 lines
915 B
Markdown
Raw Normal View History

2024-05-06 20:40:05 +00:00
---
2024-10-30 17:34:11 +00:00
date: 2020-10-26
2024-05-06 20:40:05 +00:00
id: d773822a-2ab2-4661-b5fa-8e16c5fe0dc4
title: ES2017
---
# Description
What's new in ES2017
# Async functions
## Fulfilling a [promise](20200911154351-promises)
``` javascript
async function asyncFunc() {
return 123;
}
asyncFunc().then((x) => console.log(x));
// 123
```
## Rejecting a [promise](20200911154351-promises)
``` javascript
async function asyncFunc() {
throw new Error("Problem!");
}
asyncFunc().catch((err) => console.log(err));
// Error: Problem!
```
# Object functions
- [Object.entries](20201113102048-object_entries)
- [Object.values](20201113102106-object_values)
- [Object.getOwnPropertyDescriptors](20201113102125-object_getownpropertydescriptors)
# String methods
Pads the beginning of a [string](20200922164551-strings)
- [padStart](20201112095657-javascript_string_padstart_method)
- [padEnd](20201112095711-javascript_string_padend_method)