pub fn function_ctor(args: &[Value]) -> Result<Value, String>Expand description
new Function(p1, …, pN, body) / Function(p1, …, pN, body).
Argument convention (20.2.1.1.1): the LAST argument is the body and the rest
are parameter-list fragments joined with , — so a fragment may itself hold
several parameters (new Function('a,b', 'c', …) takes three). With no
arguments at all, both the parameter list and the body are empty.
Measured on node v26.7.0:
new Function('a','b','return a+b').toString() === 'function anonymous(a,b\n) {\nreturn a+b\n}'
new Function().toString() === 'function anonymous(\n) {\n\n}'
new Function('a,b','c','return [a,b,c]').length === 3
new Function('a','b','return a+b').name === 'anonymous'