File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -221,8 +221,8 @@ it has found one:
221
221
``` {sandbox: "homepage"}
222
222
function talksAbout(node, string) {
223
223
if (node.nodeType == Node.ELEMENT_NODE) {
224
- for (let i = 0; i < node.childNodes.length; i++ ) {
225
- if (talksAbout(node.childNodes[i] , string)) {
224
+ for (let child of node.childNodes) {
225
+ if (talksAbout(child , string)) {
226
226
return true;
227
227
}
228
228
}
@@ -236,12 +236,6 @@ console.log(talksAbout(document.body, "book"));
236
236
// → true
237
237
```
238
238
239
- {{index "childNodes property", "array-like object", "Array.from function"}}
240
-
241
- Because ` childNodes ` is not a real array, we cannot loop over it with
242
- ` for ` /` of ` and have to run over the index range using a regular ` for `
243
- loop or use ` Array.from ` .
244
-
245
239
{{index "nodeValue property"}}
246
240
247
241
The ` nodeValue ` property of a text node holds the string of text that
Original file line number Diff line number Diff line change @@ -67,6 +67,12 @@ <h2>Chapter 11</h2>
67
67
68
68
< h2 > Chapter 14</ h2 >
69
69
70
+ < p > < strong > Page 231</ strong > < em > Moving Through the Tree</ em > : Below
71
+ the code example, the text claims
72
+ that < code > for</ code > /< code > of</ code > loops don't work on DOM child
73
+ lists. But in current (even as of the book's release) browsers they
74
+ do.</ p >
75
+
70
76
< p > < strong > Page 234</ strong > (2nd) < em > Creating Nodes</ em > : In the
71
77
code, “edition” is misspelled as “editon”.</ p >
72
78
You can’t perform that action at this time.
0 commit comments