- 1

Just pointing out line 8 as one of limitations of Js object dot notation

Js object dot notation limitation https://code.sololearn.com/W41Ygn5d7wDX/?ref=app

5th Mar 2022, 8:38 PM
steve Purpose
steve  Purpose - avatar
4 odpowiedzi
+ 1
When you write the name of any key of the dictionary , you must follow the same rules when you write the name of any variable , so you should stat the name of the key by any character or _ or $ not number then you can use any number later , then your code should be as example const car={ name:"volvo", _4:"legs", $price:10000 } console.log(car['name']) console.log(car.name) console.log(car._4) console.log(car["_4"]) console.log(car.$price) console.log(car['$price'])
5th Mar 2022, 10:17 PM
Muhammad Galhoum
Muhammad Galhoum - avatar
0
Object property name when using dot notation cannot start with a digit.Every other line is ok.
5th Mar 2022, 8:40 PM
steve Purpose
steve  Purpose - avatar
0
Ok.. I'll try it out.Thanks
6th Mar 2022, 3:29 AM
steve Purpose
steve  Purpose - avatar
0
You have a good point.However I'm just trying to point out a limitation of the dot notation.
6th Mar 2022, 3:37 AM
steve Purpose
steve  Purpose - avatar