Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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