Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 140161

Synchronous control flow using coroutine in Javascript

$
0
0

I want to know if we can implement a function which can block in Javascript. For example:

var username = getUserName(); //wait for user input username in a certain way
doSth(username);

I hope getUserName can block until a valid username is input by the user. I am wondering if we could use coroutine or other ways to achieve this goal. Thank you.


Viewing all articles
Browse latest Browse all 140161

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>