Testing Objects for Properties13

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.

3 Likes