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.


Made in India with ❤️ by Rajesh Kumar Yadav

Twitter