improvements

This commit is contained in:
Ilya Kantor 2019-05-31 19:11:32 +03:00
parent 55ba66021b
commit 76b0616727
5 changed files with 21 additions and 23 deletions

View file

@ -6,7 +6,9 @@ for (let li of document.querySelectorAll('li')) {
}
```
In the loop we need to get the text inside every `li`. We can read it directly from the first child node, that is the text node:
In the loop we need to get the text inside every `li`.
We can read the text from the first child node of `li`, that is the text node:
```js
for (let li of document.querySelectorAll('li')) {
@ -16,4 +18,4 @@ for (let li of document.querySelectorAll('li')) {
}
```
Then we can get the number of descendants `li.getElementsByTagName('li')`.
Then we can get the number of descendants as `li.getElementsByTagName('li').length`.