- 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
4 ответов
+ 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'])
0
Object property name when using dot notation cannot start with a digit.Every other line is ok.
0
Ok.. I'll try it out.Thanks
0
You have a good point.However I'm just trying to point out a limitation of the dot notation.