I agree with this sentiment but why stop at JavaScript? With repl.it you can embed dozens of languages (albeit not yet editable in the embed). Here is a quick demo on my blog http://amasad.me/2015/04/09/hello-world/
The problem with embedding iframes is that each iframe runs on a separate context. For instance, you cannot define a variable in one iframe and access it from the other one.