JavaScript JavaScript Loops, Arrays and Objects Tracking Multiple Items with Arrays Using For Loops with Arrays

Tom McVay
Tom McVay
Full Stack JavaScript Techdegree Student 7,977 Points

No playList variable. My html has no playList. Any ideas? I am fairly sure my code is okay

Hey guys!

function print(list) { var listHTML = '<ol>'; for (let i = 0; i < list.length; i++) { listHTML += '<li>' + list[i] + '</li>'; } listHTML += '</ol>'; print(listHTML); } print(playList);

anything wrong with this? The only error is can't find playList. Not sure why it is not in my workspace

2 Answers

Emmanuel C
Emmanuel C
7,624 Points

I believe playList should have been in the workspace already if not, use this one

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

I copied and pasted this from other questions and answers from the questions section of the video.

Tom McVay
Tom McVay
Full Stack JavaScript Techdegree Student 7,977 Points

Alright thanks for the input guys, with the full code added it worked!