Advertisement
DigitalMag

simplest async hello world

Nov 11th, 2020
873
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var promise = new Promise(function(resolve, reject) {
  2.     function Func(){
  3.         let y=0;
  4.         for (let i = 1;i<100000000;i++){
  5.             y++;
  6.         }
  7.         console.log(y)
  8.         return y;
  9.     }
  10.     resolve(Func) // y
  11. })
  12.  
  13. // promise.then(r => console.log(r+1))
  14. promise.then(r => r())
  15. console.log('Hello, world!')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement