Skip to content

Commit 747f245

Browse files
suyeon-hongViolet-Bora-Lee
authored andcommitted
[신규 번역] Part2 1.5 주요 노드 프로퍼티 과제1 해답 (#1525)
1 parent 6fd1944 commit 747f245

File tree

1 file changed

+5
-5
lines changed
  • 2-ui/1-document/05-basic-dom-node-properties/2-tree-info

1 file changed

+5
-5
lines changed
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
Let's make a loop over `<li>`:
1+
`<li>`를 이용한 반복문을 만들어 봅시다.
22

33
```js
44
for (let li of document.querySelectorAll('li')) {
55
...
66
}
77
```
88

9-
In the loop we need to get the text inside every `li`.
9+
반복문 안에서 각각의 `li` 안에 있는 텍스트를 가져와야 합니다.
1010

11-
We can read the text from the first child node of `li`, that is the text node:
11+
`li`의 첫 번째 자식 노드인 텍스트 노드로부터 텍스트를 읽을 수 있습니다.
1212

1313
```js
1414
for (let li of document.querySelectorAll('li')) {
1515
let title = li.firstChild.data;
1616

17-
// title is the text in <li> before any other nodes
17+
// title은 <li> 안에 있는 다른 노드들보다 앞에 위치한 텍스트입니다.
1818
}
1919
```
2020

21-
Then we can get the number of descendants as `li.getElementsByTagName('li').length`.
21+
그리고 `li.getElementsByTagName('li').length`를 이용해 `li` 노드 아래에 있는 모든 `<li>` 태그의 개수를 가져올 수 있습니다.

0 commit comments

Comments
 (0)