JavaScript Calling Object's Properties | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

JavaScript Calling Object's Properties

Hi, everyone. It's been a while since my last visit of this website and i starting to forget about JavaScript's Object. May i ask if Object's name . Property's Name Is the same of Object's name[Property's Name]? Thank you.

13th Mar 2022, 1:09 AM
SOON YEE FENG Moe
1 Answer
+ 2
Yes basicly it is. With the brakets you can Access properties with "invalid" Charakters in the name Like obj['fancy-key']. With the brakets you have to write the property Name as a String with ' or ". objectName.propertyName objectName['propertyName']
13th Mar 2022, 2:23 AM
MrGrumpy
MrGrumpy - avatar