Answer by gen_Eric for confusing behavior of instanceof operator in javascript
In your Foo function, you are returning an object. This is what foo gets set to. That is not a Foo object, it's just a "normal" object.Try it this way:function Foo(){ console.log(this instanceof Foo);...
View Articleconfusing behavior of instanceof operator in javascript
Take a look at this code:function Foo () { console.log(this instanceof Foo); return { name: "nitesh" }; }foo = new Foo(); //true console.log(foo instanceof Foo) //falseWhy is foo not an instance of...
View Article