Top "Ecmascript-2017" questions

Use this tag for questions about features finalized in ECMAScript 2017.

Using async/await with a forEach loop

Are there any issues with using async/await in a forEach loop? I'm trying to loop through an array of …

javascript node.js promise async-await ecmascript-2017
Combination of async function + await + setTimeout

I am trying to use the new async features and I hope solving my problem will help others in the …

javascript async-await settimeout ecmascript-2017
How to reject in async/await syntax?

How can I reject a promise that returned by an async/await function? e.g. Originally: foo(id: string): Promise&…

javascript asynchronous typescript es6-promise ecmascript-2017
try/catch blocks with async/await

I'm digging into the node 7 async/await feature and keep stumbling across code like this This seems to be the …

node.js async-await ecmascript-2017
Use async await with Array.map

Given the following code: var arr = [1,2,3,4,5]; var results: number[] = await arr.map(async (item): Promise<number> => { await …

javascript typescript promise async-await ecmascript-2017
Use Async/Await with Axios in React.js

Following How to use async/await with axios in react I am trying to make a simple get request to …

javascript json reactjs asynchronous ecmascript-2017
How can I use async/await at the top level?

I have been going over async/await and after going over several articles, I decided to test things myself. However, …

javascript node.js async-await ecmascript-2017
How to "await" for a callback to return?

When using a simple callback such as in the example below: test() { api.on( 'someEvent', function( response ) { return response; }); } How …

javascript asynchronous callback async-await ecmascript-2017
How to use ES8 async/await with streams?

In https://stackoverflow.com/a/18658613/779159 is an example of how to calculate the md5 of a file using the built-in …

javascript node.js async-await ecmascript-2017
async function - await not waiting for promise

I'm trying to learn async-await. In this code - const myFun = () => { let state = false; setTimeout(() => {state = true}, 2000); return …

javascript node.js asynchronous ecmascript-2017