HTML:
<textarea id="ta" cols="20" rows="20">alert("Hello World");</textarea>
<input type="button" value=" Exec " onclick="exec()" />
JS:
function exec()
{
var code=document.getElementById('ta').value;
var fn=new Function(code);
fn();
}
Can anyone tell me the logic behind the code on how it display's "Hello World" and i was looking at the MDN
Does this code above creates a new alert function for me using the new Function constructor