File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change 10
10
11
11
< body >
12
12
< div >
13
- < p > This is me and I am great! </ p >
14
- < span > Sibling </ span >
13
+ < div class =" first " > First </ div >
14
+ < div class =" second " > Second </ div >
15
15
</ div >
16
16
< script src ="script.js "> </ script >
17
17
Original file line number Diff line number Diff line change 1
1
//31 Walking the DOM
2
2
3
+ /*
3
4
//32 Children of an element
4
5
console.log(document.body.firstChild)
5
6
console.log(document.body.lastChild)
6
7
// console.log(document.body.childNodes) //This will not array, they are nodes
7
8
let arr = Array.from(document.body.childNodes)
8
- console . log ( arr )
9
+ console.log(arr)
10
+ */
11
+
12
+ // 33 Parents and Siblings
13
+ console . log ( document . body . firstChild )
14
+ a = document . body . firstChild
15
+ console . log ( a . parentNode )
16
+ console . log ( a . parentElement )
17
+ console . log ( a . firstChild . nextSibling )
You can’t perform that action at this time.
0 commit comments