News for hackers. Stuff that matters.
Re:How JavaScript works: Event loop and the rise of Async pr... by ChristianBundy on Saturday October 14, 2017 @06:38PM (#15474708)
Yep.

  let lock;
  
  const log = (msg) => {
    lock = new Promise(async (resolve) => {
      await lock;
      console.log(msg);
      setTimeout(resolve, 1000);
    });
  };

  'hello world'.split('').forEach(log);

There are no comments on this comment yet.