I solved the one freeCodeCamp challenge which asked you to turn a Switch/Case statement into an object and access the properties through variables, the solution was result = lookup[val].
I initially got it wrong doing result = lookup.val.
I know it has something to do with the brackets, interpreting as a strings, and that you use dot notation when you know the properties whereas brackets when you don't, but I don't have a good grasp on it conceptually.
I got the answer just swinging in the dark and trying other stuff but can someone explain why it's a bracket vs dot?