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 trialAdam Fields
4,487 PointsInside the array literal, add three object literals. In other words, the objects array should have three values. Each ob
I believe I did this right as requested by the question what am I doing wrong.
var objects=[{name.adam,age:37},{name:james,age:23},{name:steven,age:29}];
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JavaScript Objects</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>
1 Answer
Milan Pankhania
3,734 PointsHi Adam, you are really close and almost there. There are 2 minor mistakes with the code. Firstly in the first object, the name property and value is written as name.adam - this should be name: "adam". Secondly, each name value needs to be wrapped in quote marks as they are strings, otherwise they will be treated as variables.
I've fixed the errors below:
var objects = [
{
name: "adam",
age: 37
},
{
name: "james",
age: 23
},
{
name: "steven",
age: 29
}
];
Hope that helps?
Adam Fields
4,487 PointsAdam Fields
4,487 PointsThanks I see I hadn't made the name a string