0

Where is my mistake in object?

var person = { color: "green", height: 12 name:"harry", age: 13, }; var x = person.age var y = person["age"] document.write(x) document.write(y)

10th Jul 2020, 6:43 AM
Harry star
Harry star - avatar
2 ответов
+ 1
Harry star , you haven't put a comma after height:12. That is why you are getting the error.
10th Jul 2020, 6:58 AM
Arnesh
Arnesh - avatar
- 2
First don't use document.write() Second person has on property "age". person has age property. Third use console.log() for debugging
10th Jul 2020, 6:54 AM
🇮🇳Vivek🇮🇳
🇮🇳Vivek🇮🇳 - avatar