Accessing object properties with dot and bracket notation

Accessing object properties with dot and bracket notation
0

#1

https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties/

To access the object property assigned to ‘checkProp’ in this exercise, only the bracket notation seems to work in the return line.
return myObj[checkProp];

The dot notation is not working,
return myObj.checkProp;

Can someone explain why?


#2

See the following reply I gave yesterday to someone with the same question. In the future, try using the forum search to see if your question has been asked in the past. 99% of the time someone has asked a similar question.


#3

Thank you! This was helpful