new
Construct a new instance of a callable constructor
new(func, ...rest)
Call the callable func as if it were a function, bound to a new instance of func, and with any additional
parameters occurring after func set to the positional parameters.
Note that func must either implement @@can.new,
or have a callable apply property and a prototype to work with canReflect.new
canReflect.new(DefineList, ["foo"]); // -> ["foo"]<DefineList>
Parameters
- func
{function(...)}:a constructor
- rest
{*}:arguments to be passed to the constructor
Returns
{Object}:
if func returns an Object, that returned Object; otherwise a new instance of func