I working out the inheritance and OOPS in JavaScript. I created 'A' object and 'B' object and inherited all the properties of 'B' to 'A'.
While I check the newly created object instance by using 'instanceof', I am getting both objects are true.
But I have created the object using 'B' constructor only.
function A(){
this.a = "test1",
this.b = "test2"
}
function B(){
this.c = "test3",
this.d = "test4"
}
B.prototype = new A();
var userObj = new B();
console.log(userObj instanceof B); // true
console.log(userObj instanceof A); // true, How this can be true?
