Advertisement
Guest User

Untitled

a guest
Feb 9th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. //1,2,3,4,5,done
  2. requestData(null , (res)=>{
  3. console.log(res);
  4. });
  5.  
  6.  
  7. async function requestData(req , callback){
  8. console.log(1);
  9.  
  10. await new Promise((done)=>{
  11. setTimeout(()=> {
  12. console.log(2);
  13. done();
  14. } , 2500);
  15. });
  16.  
  17. console.log(3);
  18.  
  19. var result2 = await new Promise((done)=>{
  20. setTimeout(()=> {
  21. console.log(4);
  22. done(5);
  23. } , 500);
  24. });
  25.  
  26. console.log(result2);
  27.  
  28. callback("done");
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement