Display what is on the text area

I am attempting to build an editor for jacascript, I am having a really hard time understanding the docs, so far I have been able to set up an editor using a text area and getFromTextArea() method, mode is set to “javascript” . My question is how to get the my code to display in the iframe under the editor

You can use the getValue() method to get the content from an editor instance. What you do with it after that it outside of the scope of the library.

I used the getValue() method but it does not display on iframe when calling it with iframe.src. When using s div and appending it works but it append the entire code, for example if i write console.log() in the textarea it will append console.log() not the result