JAVASCRIPT   82

src.js

Guest on 10th October 2021 02:54:01 PM

  1. function f (x) { return new Promise(resolve => {
  2.   process.nextTick(() => { resolve(x) }) }) }
  3.  
  4. async function add (x) {
  5.   return x + await f(20) + await f(30)
  6. }
  7.  
  8. add(10).then(v => { console.log(v) })

Raw Paste


Login or Register to edit or fork this paste. It's free.