Some of new ECMAScript features can boost your productivity a lot.
I would like to introduce some of my favorite features!
Spread syntax allows an iterable such as an array expression or string to be expanded.
Some examples for array are as follows:
In addition, some examples of object literals:
The DataStruct Assignment syntax makes it possible to unpack values from arrays or properties from objects.
- When an
asyncfunction is called, it returns a
- When the
asyncfunction returns a value, the
Promisewill be resoleved with the returned value
- WHen the
asyncfunction throws an exception or some value, the
Promisewill be rejected with the throw value
async function can contain an
await expression, that pauses the execution of the async function and waits for the passed
Promise‘s resolution, and then resumes the async function’s exection and returns the resolved value.
A simple example for
await/async are as follows:
When you use
async/await, You can handle error by
try-catch, like this:
🖥 Recommended VPS Service
VULTR provides high performance cloud compute environment for you.
Vultr has 15 data-centers strategically placed around the globe, you can use a VPS with 512 MB memory for just $ 2.5 / month ($ 0.004 / hour).
In addition, Vultr is up to 4 times faster than the competition, so please check it => Check Benchmark Results!!