Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //1,2,3,4,5,done
- requestData(null , (res)=>{
- console.log(res);
- });
- async function requestData(req , callback){
- console.log(1);
- await new Promise((done)=>{
- setTimeout(()=> {
- console.log(2);
- done();
- } , 2500);
- });
- console.log(3);
- var result2 = await new Promise((done)=>{
- setTimeout(()=> {
- console.log(4);
- done(5);
- } , 500);
- });
- console.log(result2);
- callback("done");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement