with new Function -syntax, a JS compiler must be launched for each function to "eval" the function body string - this is slow and should be avoided when possible:
Each time [...] the Function constructor is called on a line representing the source code, the script engine must start a mechanism that converts the source code of the executable code. This is usually expensive for performance — easily a hundred times more expensive than a simple function call for an example. (Mark Tarquin Wilton-Jones)
if you used a search in StackOverflow, you would find this question that gives very good and detailed information about it.
EDIT: as Martin said in one of the comments below, sometimes the new Function constructor is a wonderful thing. to list some examples:
but: in 99% of cases when you could use new Function , this is a bad idea, which means: just define any function that should be as it is and does not have a kind of “dynamic behavior”, you should always use "normal" functional syntax to speed up your code and avoid eval -like new Function .
source share