Home > Blockchain >  textarea javascript debug result to innerHTML paragraph "undefined"
textarea javascript debug result to innerHTML paragraph "undefined"

Time:12-31

I am doing a code editor, almost everything is working, I type the text in the texarea and press a button to load a function, and the result of the code appears on the web browser console, I am trying to do like "document.getElementById('output').innerhtml = window.eval(txtarea.value);" But it does not seem to work.

  function DebugInp(){
           var txtarea = document.getElementById('input');
           document.getElementById('output').innerHTML =  window.eval(txtarea.value);//output = paragraph in html.
         };
/** 
*My problem is that the innerHTML is showing undefined, but when I'm getting to console,
*it appears the result.
*I'm thinking of maybe getting all of the outputs of the console, but IDK how to do it
*Kind of like: document.getElementById('output').innerHTML = console.logs?
*I am still searching but any help would be nice.
*/

thanks in advance! PS: I am better at frontend dev, trying to understand more of backend so don't hate

  • Related