+ 1

In javascript, where it is ideal to use the bracket and dot notation respectively?

https://drive.google.com/file/d/1I6mAct9WSuWR53-a8wxND9GF5zyj_Rai/view?usp=drivesdk The thing is, I have experience only in python where I use bracket notation only for arrays and dictionaries and dot only for objects. But in JS...things are little different.

23rd Jan 2021, 3:56 AM
Zaltar
Zaltar - avatar
2 Answers
+ 2
Can you show here some of those examples that is confusing you? just to be clear ...
23rd Jan 2021, 4:04 AM
Ipang
0
dot notation for runtime known property names (and valid js identifier). square brackets for runtime unknown property names (or invalid js identifier).
23rd Jan 2021, 4:12 AM
visph
visph - avatar