How does the Function constructor work in JavaScript?
13:41 30 Dec 2013

HTML:



JS:

function exec()
{
    var code=document.getElementById('ta').value;
    var fn=new Function(code);
    fn();
}

http://jsfiddle.net/3Z5qP/6/

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?

javascript function