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

Maximiliane Quel
Maximiliane Quel
Courses Plus Student 55,489 Points

Displaying the list in the actual div

This has been bugging me. If we follow the video the list is not actually added to the div with the id of listDiv. Instead it is just written to the end of the page. For anyone who was wondering the same thing, I adjusted the function in the helper to change that:

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


function print(html) {
  //change from the original document.write(html)
  var listDiv = document.getElementById('listDiv');
  listDiv.innerHTML = html;

Sorry for being so annoying ?