Is there a static version of `instanceof`?

Is there a static equivalent of instanceof? I.E., rather than: obj1 instanceof Type something like: TypeA instanceof TypeB? I couldn’t find anything on the matter, so I hacked together this: function InstanceOf(type,parent) { do{ if(type === parent) return true;} while(type = Object.getPrototypeOf(type)); return false; } //… Instanceof(ChildClass, ParentClass); // = boolean But I feel like… Read More Is there a static version of `instanceof`?

Can anyone help me to undrstnd the output of the below code

let obj1 ={ fName : ‘Ayush’, lName : ‘Singh’, city: ‘Asansol’, getName : function(){ console.log(`I am ${this.fName} ${this.lName} from ${this.city}`) } } let obj2 = { fName : ‘Aman’ } obj2.__proto__ = obj1; console.log(obj1.getName()) obj2.getName() console.log(obj2.__proto__.getName()) console.log(obj1.__proto__.getName()) Here I am trying to check how proto works. Why can’t I access of obj1.proto.getName >Solution : Deprecated:… Read More Can anyone help me to undrstnd the output of the below code