js string to function code example
Example 1: javascript execute string code
var theInstructions = "alert('Hello World'); var x = 100";
var F=new Function (theInstructions);
return(F());
Example 2: javascript function from string
var addition = Function("a", "b", "return a + b;");
alert(addition(5, 3)); // shows '8'