Hacker Read top | best | new | newcomments | leaders | about | bookmarklet login

Wasn't one point also that generators and such are contagious?


view as:

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)
    }

Legal | privacy