◐ Shell
reader mode source ↗
EN

We want to make this open-source project available for people all around the world.

Help to translate the content of this tutorial to your language!

Search
Search
back to the lesson

Show descendants in a tree

importance: 5

There’s a tree organized as nested ul/li.

Write the code that adds to each <li> the number of its descendants. Skip leaves (nodes without children).

The result:

Open a sandbox for the task.

solution

To append text to each <li> we can alter the text node data.

Open the solution in a sandbox.