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 Using For Loops with Arrays

Please help

Im confused.

  • what does the function message do? theres no variable named message so then what does this function hold?.
  • what is the <Io> for? like where did that come from and what does it do?
  • where did the list of music go? he was able to print the list without creating a variable and storing the list in it. Please if someone can exaplain it a little easily for me. Here's what i imagined the code to look like:

var playList = [ 'I Did It My Way', 'Respect', 'Imagine', 'Born to Run', 'Louie Louie', 'Maybellene' ];

var message = document.write(playList);

for (var i =0; i= playList.length; i += 1) { message; }

1 Answer

Steven Parker
Steven Parker
231,275 Points

The actual code is a bit different from what you imagine ... you can see the first few lines at about 5:10 in the video, and the remainder (with some overlap) at 7:45. When you look at the real code, you'll see that:

  • "message" is not a function itself, it is the parameter of the "print" function
  • "<ol>" (not "<lo>") is the HTML tag that creates an ordered list on the page
  • the variable that holds the music is "playList", and it is passed as the argument to the "printList" function

Thank you! didn't focus on the video at all.