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
foonot an instance ofFoo? - Why is
thisan instance ofFoo?
{ name: "nitesh" } instanceof Foo.