Answer the question
In order to leave comments, you need to log in
Javascript: Eval || "new Function"?
What is better to use? Or another option? ..
upd: Which option is better to use to run js code from the server, for example?
var codeRun = "console.log('now run code')";
//Which code is better?
//run function
console.log('new Function:');
(new Function(codeRun))();
//or eval
console.log('eval:');
eval(codeRun);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question