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 trialAaron Noble
6,559 PointsInside the array literal, add three object literals. In other words, the objects array should have three values.
It says to :
Inside the array literal, add three object literals. In other words, the objects array should have three values. Each object should have 2 property/value pairs.
I've created the objects array, with 3 different object literals. Each object literal has 2 key : value pairs. What am I doing wrong? Anything to help,
Thank you,
Aaron
var objects = [
person1{
name : 'Aaron',
age : 23,
},
person2{
name : 'Svetlana',
age : 45,
},
person3{
name : 'Bruce',
age : 43,
},
];
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JavaScript Objects</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>
2 Answers
Steven Parker
231,275 PointsYou're pretty close, but when defining an object literal start with an open brace. There should be no name preceding it.
Also, commas separate the properties of an object, and also the elements of an array. But there should not be a comma after the last property or element.
Lynn Collins
10,080 PointsNo offense, but it's not working.
Steven Parker
231,275 PointsYour code probably has different issue(s). Start a fresh question using the "get help" button in the challenge after entering your code.
Aaron Noble
6,559 PointsAaron Noble
6,559 PointsNice catches, that all makes sense. Thank you for the help on this problem!!