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.
November 01, 2022
1809
Read more
What is the JavaScript += Operator and How Do You Use It?
December 04, 2022
JavaScriptUsing the startsWith() Method in JavaScript
December 04, 2022
JavaScriptReverse a String in JavaScript: 2 Easy Methods
December 02, 2022
JavaScript