← Back to HTML DOM
Question 187
Count List Items
Count List Items
Count how many<li>items are inside the list with id="list" and show that number (3) as the text of the paragraph with id="count". Platform-Provided HTML (READ-ONLY):<div id="app"><ul id="list"><li>A</li><li>B</li><li>C</li></ul><p id="count"></p></div>Steps: 1. Readlist.children.lengthto count the list items. 2. Assign that number to thetextContentof#count.
Expected Output:
<div id="app"> <ul id="list"> <li>A</li> <li>B</li> <li>C</li> </ul> <p id="count">3</p> </div>
= newline. No newline after the last line.
Hints2 available
Sign in to use hintsTopics:
HTML DOM
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (clog, fn, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.