Why does this code obj.someprop.x throw an error?

Obviously, this throws an error due to the reason we are trying to access a x property in the someprop property which have an undefined value. Remember properties in an object which does not exist in itself and its prototype has a default value of undefined and undefined has no property x.


Author of content
Edit this page

Made by Michael Sakhniuk

Twitter