Skip to content

Instantly share code, notes, and snippets.

@christianbundy
Created October 14, 2017 20:02
Show Gist options
  • Save christianbundy/45347c328e577584cf21d68aadc8649b to your computer and use it in GitHub Desktop.
Save christianbundy/45347c328e577584cf21d68aadc8649b to your computer and use it in GitHub Desktop.
let lock;
const log = (msg) => {
lock = new Promise(async (resolve) => {
await lock;
console.log(msg);
setTimeout(resolve, 1000);
});
};
'hello world'.split('').forEach(log);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment