Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const asyncFunc = async () => {
- await setTimeout(() => console.log("Waited for a response"), 5000);
- return true;
- };
- var whileFunc = async () => {
- let x = false;
- while (!x) {
- x = await asyncFunc(); // stop when you want
- }
- };
- whileFunc();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement