Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript JavaScript Loops, Arrays and Objects Tracking Data Using Objects The Build an Object Challenge, Part 2 Solution

Anderson Martinez
Anderson Martinez
7,988 Points

my code wont show up. I am not sure what is wrong

here is my code. I am not sure what I am doing wrong

var students [
{name: "Sasha", track: "IOS", achieve:"50", points:"2300"},
{name: "Devora", track: "CSS3", achieve:"32", points:"1200"},
{name: "Morris", track: "C++", achieve:"78", points:"4000"},
{name: "David", track: "JavaScript", achieve:"64", points:"3400"},
{name: "Thanos", track: "Ruby", achieve: "99", points: "9999"}

var message = " ";
var student;

function print(message) {
    var outputDiv = document.getElementById("output");
    outputDiv.innerHTML = message;

for (var x = 0; x < students.length; x += 1){
    student = students[x];
    message += "<h2>Student: " + student.name + "</h2>";
    message += "<p> Track: " + student.track + "</p>";
    message += "<p> Achievement: " + student.achieve + "</p>";
    message += "<p> Points: " + student.points + "</p>";

Austin Whipple
Austin Whipple
29,687 Points

I've edited your question to format your code block. As Steven mentioned in their answer, be sure to check out the Markdown Cheatsheet below the text editor for more information.

1 Answer

Steven Parker
Steven Parker
216,020 Points

It looks like you're missing the assignment operator ("=") on the top line where you initialize the "students" array.

When posting code in future, use the instructions for code formatting in the Markdown Cheatsheet pop-up below the "Add an Answer" area. :arrow_heading_down:   Or watch this video on code formatting.