解决方法
spec(第127页)说它们是完全相同的.
15.3.1.1 Function (p1,p2,…,pn,body)
When the
Function
function is called
with some arguments p1,
body (where n might be 0,that is,
there are no “p” arguments,and where
body might also not be provided),the
following steps are taken:
- Create and return a new Function object as if the standard built-in
constructor Function was used in a new
expression with the same arguments
(15.3.2.1).
但是,您应该不惜一切代价避免使用Function cinstructor.它需要评估你传递给它的字符串; eval是邪恶的,也是缓慢的.