Count List Items
mediumQuestion 187Count 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. Read list.children.length to count the list items.
2. Assign that number to the textContent of #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.