This little library essentially allows you to set up a separate execution environment for JavaScript. For this purpose it uses iframe. It isn't guaranteed to be 100% safe but is likely enough for some quick hacks.
If you want to see it in action, check out webide.
MIT. See LICENSE for more info.