rgadellaa’s avatarrgadellaa’s Twitter Archive—№ 9,625

  1. …in reply to @DanShappir
    @DanShappir @jaffathecake Yeah I was batching a bunch of promises and used the new Promise() to encapsulate some variables. const ps = [ new Promise( () => { const x = 'a'; return doWork(x); }), new Promise( () => { const x = 'b'; return doWork(x); }), ]; Promise.all( ps);
    1. …in reply to @RGadellaa
      @DanShappir @jaffathecake (in the example above, doWork is a promise/async) That way I didn't need to have unique names for every 'x' variable, kept the code readable.
    2. …in reply to @RGadellaa
      @DanShappir @jaffathecake It made sense at the time I was writing it 😅