The Function constructor
creates a new Function
object
. Calling the constructor directly can create functions dynamically, but suffers from security and similar (but far less significant) performance issues as eval()
. However, unlike eval
(which may have access to the local scope), the Function
constructor creates functions which execute in the global scope only.