ciąg do kodu JavaScript
var theInstructions = "alert('Hello World'); var x = 100";
var F=new Function (theInstructions);
return(F());
Different Deer
var theInstructions = "alert('Hello World'); var x = 100";
var F=new Function (theInstructions);
return(F());
// try using parsInt(x)
// you can then use typeof(x) to confirm
var myString = "555";
var myInt = parseInt(string);
console.log(typeof myInt); // number
var x = parseInt("1000", 10); // you want to use radix 10
// so you get a decimal number even with a leading 0 and an old browser ([IE8, Firefox 20, Chrome 22 and older][1])
function ExecuteJavascriptString()
{
var s = "alert('hello')";
// how do I get a browser to alert('hello')?
}