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 trial

JavaScript JavaScript Loops, Arrays and Objects Tracking Multiple Items with Arrays Two-Dimensional Arrays

Annemarie Troost
Annemarie Troost
5,735 Points

Why isn't it printing anything on the screen

I can nog figure out why this code isn't printing anyting on the screen. Can someone help me?

var playList = [
  ['I Dit It My Way', 'Frank Sinatra'],
  ['Respect', 'Aretha Franklin'],
  ['Imagine', 'John Lennon'],
  ['Born to Run', 'Bruce Springsteen'],
  ['Louie Louie', 'The Kingsmen'],
  ['Maybellene', 'Chuck Berry']
];

function print(message) {
  document.write(message);
}

Function printSongs( songs ) {
  bar listHTML = '<ol>;
  for ( var i = 0; i < songs.length; i += 1) {
    listHTML += '<li>' + songs[i][0] + ' by ' + songs[i][1] + '</li>';
  }
  listHTML += '</ol>';
  print(listHTML);
}

printSongs(playList);

2 Answers

Julio Andrade
PLUS
Julio Andrade
Courses Plus Student 10,896 Points

You have a few things wrong, minor mistakes. For starters on line 14 "printSong function" you have the word function capitalized. Second on line 15 instead of tying var you typed bar Lastly on like 15 again you forgot the closing quotation after the <ol> tag. Hopefully that helps

Annemarie Troost
Annemarie Troost
5,735 Points

Thanks Julio, my code is working now. I'm always stuck becouse of typo's.

Julio Andrade
Julio Andrade
Courses Plus Student 10,896 Points

Hey it happens. There's moments when I am doing a project and I can't figure it out and I just want to punch the computer. A second set of eyes always helps. Also I would recommend using the console on your web browser, a lot of times it will actually tell you exactly what the problem is