I don’t know how to say this nicely, but your reply perfectly illustrate the problem.
but why do we use brackets? Your steps behind. Yes, we have to use brackets (the associative array notation). But its important to understand why
so, objects and associative arrays are the same thing in JS. But this leaves us with two notation to access a property:
obj.prop // object notation
obj['prop'] // associative array notation
in this exercise we can’t use the object notation because we want to pass the property/key as argument to a method. Which means we have to use the associative array notation.
I made quite a leap there, didn’t I?
if you try to pass the property:
you get an undefined variable, which is why we can’t use object notation.