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) //false
- Why is
foo
not an instance ofFoo
? - Why is
this
an instance ofFoo
?
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) //false
foo
not an instance of Foo
?this
an instance of Foo
?