JSFiddle - React, Tailwind, and code Playground

by Eugen Sunic

JavaScript

const sleep = async time => new Promise(resolve => setTimeout(resolve, time));
const interruptRunner = async actions => {
  for (let action of actions) {
    await action();
  }
};

(async () => {


  // Doesn't work, I recieve Promises in interruptRunner
  await interruptRunner([
    async () => void (await sleep(2 * 1000)),
    () => console.log("Hello from Fat Arrow"),
    async () => void (await sleep(2 * 1000)),
    () => console.log("Hello from Fat Arrow"),
  ]);

})();