+ 2
[SOLVED]Please I want to output the value of object (cars) but I only get the index
6 Answers
+ 1
https://code.sololearn.com/WeQWVPXdkHpQ/?ref=app
Add link description place.. In question place , it won't work..
edit: try this
Muhammad Awwal Yusuf
for (let i in myObj.cars) {
document.write(myObj.cars[i].name + "<br>")
}
+ 1
Thanks Jayakrishnađźđł it worked
+ 1
But if I wanted to access the first array of the "models" of the car [0] alone, how do I do that?
+ 1
https://code.sololearn.com/WeQWVPXdkHpQ/?ref=app
See my comment here Jayakrishnađźđł
+ 1
Solved other issues , thanks all
+ 1
If according to your comment you only want to print "fiesta" your code would look like this:
document.write(myObj.cars[0].models[0] + "<br>")