The above is undefined, because there is no actual property named “checkProp” in myObj. When you use dot notation with an object, the actual property name you specify after the dot must exist in the object.
You might want to review the following challenges on accessing object properties to make sure you understand when you can use dot notation and when you must use bracket notation. Basically, you can always use bracket notation, but depending on the circumstance, you might be able to use dot notation instead.
Because if you write gift then it is considered a variable and is evaluated as such (as you have not assigned anything to gift its value is undefined, or it throw an error because it has not been declared anywhere), instead "gift" is a string and it is treated as it is
Thank you. Actually, I’ve never thought about properties as variables before…I wonder if there is a hidden code interpreted by the program while creating an object with a property’s key called: gift, like this: