javascript - why **(Object.__proto__ instanceof Function)** === false? -


why object._proto_ instanceof function gives me false?

alert(object.__proto__ ); //  object.__proto__ function right? alert(typeof object.__proto__); // object.__proto__ function right? alert(object.__proto__ instanceof function); // ! 

not functions created via function constructor. instanceof checks see if given item created that specific function.

you similar effect in browser environments when dealing multiple windows. mean, if have function foo in window a:

function foo(arg) {     if (arg instanceof array) {         // it's array,     } } 

...and have code in another window b calls it:

opener.foo([]); 

...then you'd expect foo realize arg array, right? doesn't, because although arg is array, wasn't created array constructor in window foo in.

more figuring out things here: say what?

if you're fascinated stuff (as seem be), there's nothing quite reading the specification. yes, prose is...dry...and terminology is....dense...but gets more , more interesting learn more , more underlying workings.


off-topic: beware __proto__ non-standard , not supported javascript implementations.


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -