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 trialDavid Loder
4,987 PointsI have the code written as shown but cannot get it displayed onto the page. Can anyone debug for me?
This should be the code. Is there anything I'm missing? I need a second pair of eyes. var playLists = [ ['I Did 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 ) { 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); }
printSongs(playList);
2 Answers
KRIS NIKOLAISEN
54,971 PointsIf you run it through the console you'll see:
Uncaught ReferenceError: playList is not defined
This
printSongs(playList);
should be
printSongs(playLists);
Laura Owens
15,044 PointsI'm using Atom for my text editor. On the last segment, I had a similar error. My code wouldn't run because one of the many "playLists" variables was missing a capital L.
In Atom, when you click on one variable, it highlights all uses of the same variable.
I got the error in the console, but couldn't find it in my code. That's how I discovered the clicking on one and seeing all of the uses thang.
Hope that helps in the future!
David Loder
4,987 PointsDavid Loder
4,987 PointsThanks Kris. I would have never caught that.