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

Sean Loke
Sean Loke
14,659 Points

List missing during display even though exact code as Teacher

https://w.trhou.se/ns10yxzdxj

// square brackets = empty array literal var playList = [ ['I Did It My Way', 'Frank Sinatra'], ['Feel it Coming', 'The Weekend'], ['Lost in the Echo', 'Linkin Park'], ['In My Remains', 'Linkin Park'] ];

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

function printSongs( songs ) { var 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); }

printList(playList);

Anyone can help me spot any errors in my code? Its not displaying anything.

1 Answer