See code below. Why test2()is it causing an error, but test1()not? How to avoid an error (without overriding the called function inside the constructor)?
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
var xyz = function (){
var test1 = function () { getRandomInt(10, 20); };
test1();
var test2 = new Function('getRandomInt(10, 20);');
test2();
};
source
share