name: duk_new proto: | void duk_new(duk_context *ctx, duk_idx_t nargs); stack: | [ ... constructor! arg1! ...! argN! ] -> [ ... retval! ] summary: |
Call a constructor function with nargs
arguments
(not counting the function itself). The function and its arguments
are replaced by a single return value. An error thrown during the
constructor call is not automatically caught.
The target function this
binding is set to a freshly
created empty object. If constructor.prototype
is an
object, the internal prototype of the new object is set to that
value; otherwise the standard built-in Object
prototype
is used as the internal prototype. The return value of the target
function determines what the result of the constructor call is.
If the constructor returns an object, it replaces the fresh empty object;
otherwise the fresh empty object (possibly modified by the constructor)
is returned.
See [[Construct]].