Skip to content Skip to sidebar Skip to footer

Js - Why My Output Is Object { } Instead Of: Myobj { }?

When using the webdev tools console, if type a browser object, it returns console > console Console { } > console.log(console) undefined > Console { } Works in this way

Solution 1:

Because MyObj inherits from built-in Object. The console outputs as if it is Function, Array, Object, etc. but not what you've created an object which is just an instance. So, it just outputs that which are in prototype chain.


Post a Comment for "Js - Why My Output Is Object { } Instead Of: Myobj { }?"