javascript - What is the function constructor in Node.js? -
in browser (chrome @ least) functions instances of function
settimeout instanceof function // true
however in node, not
settimeout instanceof function // false
so settimeout
's constructor if not function
?
it seems constructor function
, 1 realm.
if run code
console.log(object.getownpropertynames(settimeout.constructor.prototype));
you array typical function.prototype
methods call
, apply
, bind
.
so guess it's analogous happens in web browsers when borrow settimeout
iframe:
var iframe = document.createelement('iframe'); document.body.appendchild(iframe); var win = iframe.contentwindow; console.log(win.settimeout instanceof function); // false console.log(win.settimeout instanceof win.function); // true
Comments
Post a Comment