Comment
Comment by jpolitz
This worked for the whole first chapter for me (and has some obvious further applications):
EDIT: I wonder if you could wrap the user's code in, e.g. https://code.google.com/p/es-lab/wiki/SecureEcmaScript, and use this to gamify finding bugs in that sandbox :-)