H
HopfZ
How can I create a function nF such that for example
var sum = nF('a','b','return a+b');
and
var sum = new Function('a','b','return a+b');
do the same?
function nF(){
return new Function(arguments);
} // won't work. because Function expects first argument to be a
string, not an agruments list.
function nF(){
return (new Function).apply(null,arguments);
} // won't work. (new Function) is not a function.
var nF = Function; // wont' work.
var sum = nF('a','b','return a+b');
and
var sum = new Function('a','b','return a+b');
do the same?
function nF(){
return new Function(arguments);
} // won't work. because Function expects first argument to be a
string, not an agruments list.
function nF(){
return (new Function).apply(null,arguments);
} // won't work. (new Function) is not a function.
var nF = Function; // wont' work.