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 Build a Quiz Challenge, Part 2 Solution

Zachary Baker
PLUS
Zachary Baker
Courses Plus Student 11,504 Points

problems with my array in JS.

My quiz application isn't printing out all of the questions in the program and it's listing the right and wrong questions with bullet points, not numbers. What am I missing?

Here is a copy of my workspace: https://w.trhou.se/3c5gegcbh9

2 Answers

Hey Zachary,

I went over your code and I believe your problem is in the buildList function. View Below.

function buildList(arr) {
  var listHTML = '<ol>';
  for (var i = 0; i < arr.length; i++) {
    listHTML += '<li>' + arr[i] + '</li>'; // missing + sign here. details below
  }
  listHTML += '</ol>'; 
  return listHTML;
}


/* ------------------------------------------
 * you need a + in front of the equal 
 * sign to signify you are added list 
 * items for each item in the array.
 * ------------------------------------------*/ 

I hope this helps.

Zachary Baker
PLUS
Zachary Baker
Courses Plus Student 11,504 Points

Thank you! I really appreciate the help Chyno! That solved all of my problems!