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

Ioana Sauluc
Ioana Sauluc
3,251 Points

Quiz part2 arrays

Can you please have a look to my code. It does not listed an ordered list with numbers, just with bullet points. I think something is wrong. Please can you explain me. Thank you. https://w.trhou.se/p3w47jiqzv. Quiz number 1 file.

3 Answers

Steven Parker
Steven Parker
229,921 Points

Line numbers are added to ordered lists ("ol"), but there are not any on the page. On lne 33, there is code that adds an "<ol>' tag, but on the next line an ordinary assignment (=) cancels that assignment by putting new contents in place of it.

To add on instead of replace you need this symbol instead :point_right: +=

Also be aware that it's not proper HTML to have anything other than "li" as a direct child element of of a list (either "ul" or "ol").

Steven Parker
Steven Parker
229,921 Points

Examples:

<!-- Good HTML, the list has only "li" inside (child elements) -->
  <h2>...</h2>
  <ol>
    <li>...</li>
    <li>...</li>
    <li>...</li>
  </ol>

<!-- BAD HTML, the list has other child elements than "li" -->
  <ol>
    <h2>...</h2>  <!-- does not belong inside a list! -->
    <li>...</li>
    <li>...</li>
    <li>...</li>
  </ol>
Ioana Sauluc
Ioana Sauluc
3,251 Points

Thank you very much Steven. Can you please explain me again what you want to say with the last sentence. I am still have a lot of thing to learn so it will be helpful to explain in a simpler way. Like, what is a child element? You suggest to not use "li" just "ol"? Thank you a lot for patience .

Steven Parker
Steven Parker
229,921 Points

I added a comment to my answer with examples.

Ioana Sauluc
Ioana Sauluc
3,251 Points

Yes indeed, I just saw. Thank you very much.