I’m interested in the possibility of using JavaScript for an introductory language for students. The missing piece for me is the ability to provide a blocking equivalent to the input() command that is available in other languages.
Using console-only versions of JavaScript, like SpiderMonkey, would be a solution. SpiderMonkey has a readline() command. But I think the students would be more interested in code that ran inside a web browser. It would be nice if students could share with their friends their version of the classic “guess a number between 1 and 10” game.
The JavaScript window.prompt() command would also work, but the fact that it pops up a completely separate window isn’t ideal. I’d like an in-document input field that works the same way. Is there such a solution?
prompt()is the only thing that comes to mind as a blocking input method. I don’t exactly know why you need to make it blocking, but perhaps you can use the jQuery blocking pluginto achieve the blocking (at least the UI)?