Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialBakari Lewis
6,556 PointsNeed help? Not sure what I am doing wrong. Thanks!
Isn't this how you place in object inside of an array? I guess I am wrong.
var name = [ { XXX: asdf, } ]
var objects =[
{
name: "Shaq",
height: "190"
hero: 'Kobe'
},
{
name: "LeBron",
height: "700"
Hero: 'Jordan'
},
name: 'Kobe',
height: "670"
Hero: 'Jordan'
}
]
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JavaScript Objects</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>
1 Answer
Logan R
22,989 PointsSo you are doing a few things wrong, but you are really close.
First off, you are missing a {
for your third property, but more importantly, in the instructions it says "Each object should have 2 property/value pairs." Remove the third property and add the { and you should be good! As a note, after each property, there should be a comma, unless it's the last property in the array.
var objects =[
{
name: "Shaq",
height: "190"
},
{
name: "LeBron",
height: "700"
},
{
name: 'Kobe',
height: "670"
}
]