Skip to content

Instantly share code, notes, and snippets.

@malcolmstill
malcolmstill / 1-easy.js
Created April 8, 2021 03:02 — forked from nybblr/1-easy.js
3 examples of using Async Generators and Async Iteration in JavaScript!
// Create a Promise that resolves after ms time
var timer = function(ms) {
return new Promise(resolve => {
setTimeout(resolve, ms);
});
};
// Repeatedly generate a number starting
// from 0 after a random amount of time
var source = async function*() {