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 Adding Data to Arrays

Ricardo De Jesus
Ricardo De Jesus
5,530 Points

My playlist is not showing up when the page is loaded. The console says there is no error?

My playlist is not loading up and after taking a good look at my code, I did not see anything out of place. Does anyone see something I don't? Thank you very much!

var playList = [];

playList.push('I Did it My Way');
playList.push('Respect', 'Imagine');
playList.unshift('Born to Run');
playList.unshift('Louie, Louie', 'Maybellene');

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

function print(html) {
  document.write(html);
}
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Musical Playlist</title>
  <link rel="stylesheet" href="css/styles.css">
</head>
<body>
<h1>My Music Playlist</h1>
<div id="listDiv">

</div>

<script src="js/helpers.js"></script>
<script src="js/playlist.js"></scrip>

</body>
</html>

1 Answer

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hi Ricardo,

It looks like you have a typo in your closing script tag for playlist.js. You missed a "t".

:)

Ricardo De Jesus
Ricardo De Jesus
5,530 Points

wow, thank you very much. I spent so much time trying to figure it out and the whole time it was that simple. Thanks!