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

Keith Grimes
10,263 PointsOrdered list not incrementing.
Instead of getting:
- (correct question)
- (correct question)
I'm getting:
"1. (correct question)
- (correct question)"
Why?
for(let x = 0; x < answersCorrect.length; x++) {
htmlCorrect += document.querySelector(`main`).innerHTML = `
<ol>
<li>${answersCorrect[x]}</li>
</ol>
`;
};
1 Answer

Steven Parker
240,995 PointsThis code is creating a separate ordered list (starting at 1) each time through the loop. To create just one list, iterate only the list items. And updating the page can be done just once after the loop finishes:
for (let x = 0; x < answersCorrect.length; x++) {
htmlCorrect += `<li>${answersCorrect[x]}</li>`; // iterate only the items
}
// then make just one list
document.querySelector(`main`).innerHTML = "<ol>" + htmlCorrect + "</ol>";