KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Are these two functions doing the same thing behind the scenes? (in single statement functions) var evaluate = function(string) { return eval('(' + string + ')'); } var func = function(string) { return (new Function( 'return (' + string + ')' )()); } console.log(evaluate('2 + 1')); console.log(func('2 + 1'));
Tags (comma-separated)
Save Edits
Cancel