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 trialDaniel Williams
Courses Plus Student 1,325 Pointshow do I make this code correct with respect to the task?
tried several versions to accomplish getting the code correct. I keep missing out
var objects = {
fruits: ['mangoes', 'oranges', 'apples'],
vegetables: ['carrots', 'spinach', 'cabbage'],
price: [55]
};
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JavaScript Objects</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>
1 Answer
andren
28,558 PointsThe task is to create an array with three objects with two values. You have created 1 object with 3 properties containing arrays.
Here is an example of what the challenge is looking for:
var objects = [
{property1: "prop 1", property2: "prop 2"},
{property1: "prop 1", property2: "prop 2"},
{property1: "prop 1", property2: "prop 2"}
];
There is one array which contains three objects, each object contains two properties. The name of the properties and what they contain is irrelevant to the challenge, as long as there are three objects which each contain two properties your code will pass.