4 ms·
async is contagious, generators are not. const foo = async () => {} const mustAlsoBeAsync = async () => console.log(await foo()) const gen = funct
by lhorie 7y ago
async is contagious, generators are not.
const foo = async () => {}
const mustAlsoBeAsync = async () => console.log(await foo())
const gen = function* () {
let n = 10
while (n) yield n--;
}
const doesntNeedToBeGenerator = () => {
for (const n of gen()) console.log(n)
}