Advertisement
Mdoyleazz

Untitled

May 23rd, 2022
957
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const asyncFunc = async () => {
  2.   await setTimeout(() => console.log("Waited for a response"), 5000);
  3.   return true;
  4. };
  5.  
  6. var whileFunc = async () => {
  7.   let x = false;
  8.   while (!x) {
  9.     x = await asyncFunc(); // stop when you want
  10.   }
  11. };
  12.  
  13. whileFunc();
  14.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement