JavaScript ES6 promise for loop
for (let i = 0; i < 10; i++) { const promise = new Promise((resolve, reject) => { const timeout = Math.random() * 1000; setTimeout(() => { console.log(i); }, timeout); }); // TODO: Chain this promise to the previous one (maybe without having it running?) } The above will give the following random output: 6 … Read more