+ 1
Whats the need of "[ ]"??
I wrote the following code and when I called 'val.name' it gave me an uncaught error for using '.' I saw in a solution that it was enclosed in sq brackets [ ] and tried the same and it worked. But I can't make out what exactly does the sq brackets do. Please help if u know that. https://code.sololearn.com/WkJP6kfWxV99/?ref=app
3 Réponses
+ 4
That syntax is called "Computed Properties".
I think it's well explained here:
https://www.sololearn.com/learn/JavaScript/2975/
+ 1
That use to form list.
0
"[ ]" this means list, in which we can put any integers and string.