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 Flynn
Front End Web Development Techdegree Student 4,900 PointsWhat am I doing wrong here? JS Challenge
I'm not sure what I am doing wrong here. I obviously am not sure as to what is being asked. Please help.
var objects = [
var student = {
firstName: "daniel",
lastName: "flynn",
middle: "j";
}
var grades = {
homeWork: [93],
tests: [97],
quizScores: [98];
}
var address = {
city: "Sheridan",
county: "Yanhill",
street: "Bridge";
}
];
<!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 PointsYou seem to understand the gist of the task, but there are some fundamental issues with your code:
- Arrays cannot store variable declarations. Arrays are just a list of values separated by a comma.
- Putting a semicolon after the last property of an object is invalid. No special symbol is needed after the last property.
- The challenge asks for each object to have two properties, you have given them three.
If you remove all of the variable declarations, remove the semicolons and remove the third property of each object. Like this:
var objects = [
{
firstName: "daniel",
lastName: "flynn"
},
{
homeWork: [93],
tests: [97]
},
{
city: "Sheridan",
county: "Yanhill"
}
];
Then your code will pass the challenge.
Emma Walker
1,390 PointsEmma Walker
1,390 PointsThe idea is to have an array of student objects, each is a different student but each has the same information about each student: their first name, last name and grade, for example. They shouldn't be variables. You also need commas between the different array objects.