If anyone has seen the games on Code.org, users can enter code and submit their code. The server validates the code and sends the code to the javascript game which seemingly runs the code in the game to perform some action.
How do you validate/check code users have submitted in a html textbox, then have your javascript game execute the code?
What do I need to achieve this? Does there need to be a javascript compiler running on the server side? How does the game then run the code?
At Code.org we use a forked version of JS-Interpreter, which is an open-source JavaScript interpreter that runs on the client. User code is sent to the server when it needs to be saved for later use, but not to execute.