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.