Try-it yourself editor

So we have a homework to do in my web programming course. We're required to do a "try-it yourself editor" web page with 2 methods: One using frames and the other using dev and eval function. The frames worked with me but I tried doing the devs and eval method but it's not working.

Do you have any idea how can create the try-it yourself editor using the second method?