+ 8

Why dosent it prints the object?

I have made this object ,but when i am printing it its just showing [objects,objects], Is there any problem in the code , Please help https://code.sololearn.com/W5GEZvQUm4mm/?ref=app

18th Sep 2020, 10:45 AM
‎Ashwin Maurya
‎Ashwin Maurya - avatar
2 Respostas
+ 6
No it is right but for some reason it doesn't show the object values ,you need to iterate over the object to see values or you can use =>JSON.stringify(myObj)
18th Sep 2020, 10:48 AM
Abhay
Abhay - avatar
+ 5
If you want to access all Values which you write then you have to access like this let myobj = { 'name': 'ashwin', age: '17', hello: true, marks: [1,5,3,6] } document.write(myobj.hello); document.write(myobj.marks); document.write(myobj.age); //console.log(myobj['age']) //console.log(myobj.marks)
18th Sep 2020, 10:49 AM
A S Raghuvanshi
A S Raghuvanshi - avatar