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

1 Answer

Hi there,

Just a couple things keeping this from running:

  • In your index.html, it's currently just looking for 'helpers.js', but the file is actually in the js folder. That means you need to add the folder to the address, like this:
<script src = "js/helpers.js"></script>
  • In helpers.js, there is a comma on line 7, after the playList variable. To fix this, just clear that line.

After I did these two things, it loaded with your list of songs - good luck!

Enemuo Felix
Enemuo Felix
1,895 Points

Bless you Katie! Thank you for the rescue again. Just to be clear, I'll like to know why the playlist are numbered. Is it because the items in the array is written out in separate lines like this?

var PlayList = [
'Galway Girl' ,
'Shape of You' ,
'Hills' ,
'Stupid Song'
];

Good question!

It's numbered because of the printList() function. If you check out how it writes the html, it uses the <ol> tag - that's an ordered list. That means that the list defaults to numbered values.

Enemuo Felix
Enemuo Felix
1,895 Points

Wonderful! Thank you so much. I need to pay a lengthy visit to css an Html since I started with JS, but I don't know the best time to do that. I'v always wondered if this JS course will ever end