Hi, I was doing this challenge but I don’t understand why trying to access the object’s property through dot notation doesn’t work but bracket notation does. Anyone know why is this?
With dot notation, you are looking for the property name
checkProp while with bracket notation you are looking for the property name stored in the variable
Hello and welcome to the FCC community~!
The dot notation
obj.checkProp looks for a property that is actually called
Dot notation doesn’t play well with variables. The bracket notation
obj[checkProp] will look for the property name that matches the value of
I think I get it, thank you!