Run javascript in a htmlview

I want to run a JavaScript code snippet in a htmlview. I tried:

HTMLview1.innerHTML = “this is a line< br>< script>alert(‘Hello world!’);< /script>”

What do I have to do to make it work? Only the “this is a line” is visible

What are you trying to do here? There may be a better way.

I try to create an app that is a tutorial for JavaScript where you can enter Code snippets an they will be executed in a separate htmlview.

There’s another way to do this. Have you seen the eval() function?

that is exactly what I was looking for. Thank you