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
172,140 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.