1
2
3
4
5
6
7
8
9
10
To practice on your own, or to check code you believe shouldn't have been scored as incorrect, go to CodePen.
0,1,2,3,4,5,6,7,8,9
0
0
0
0
Siblings are nodes that share the same ______. | parent | parent | |
If your markup is minified so you don't have to worry about irrelevant whitespace, you can use ______ to find the next sibling. | nextSibling | nextSibling | |
An image has been assigned to a variable, pic. The markup hasn't been minified. Target the previous element sibling of pic. Assign it to a variable that hasn't been declared beforehand. Make up the name of the variable. | let sib = pic.previousElementSibling; | let[a-z_$][a-zA-Z0-9_$]*=pic\.previousElementSibling; | |
An element has been assigned to a variable, pgraph. Code a ridiculously circular statement. Use previousSibling and nextSibling to display the text content of pgraph in the console. Use chaining. | console.log(pgraph.previousSibling.nextSibling.textContent); | console\.log\(pgraph\.previousSibling\.nextSibling\.textContent\); | |
An element has been assigned to a variable, e. The markup hasn't been minified. Display the text content of the second sibling of e using nextElementSibling. Use chaining. | console.log(e.nextElementSibling.nextElementSibling.textContent); | console\.log\(e\.nextElementSibling\.nextElementSibling\.textContent\); | |
An element has been assigned to a variable, e. In the console, display the node name of the first child element of the next element sibling. | console.log(e.nextElementSibling.children[0].nodeName); | console\.log\(e\.nextElementSibling\.children\[0\]\.nodeName\); | |
An element has been assigned to a variable, el. Code the first line of an if statement checking whether the element has a previous sibling of any type. | if (el.previousSibling) { | if\(el\.previousSibling\){ | |
An element has been assigned to a variable, el. In the console display the node name of the next element sibling of el's second element child. | console.log(el.children[1].nextElementSibling.nodeName); | console\.log\(el\.children\[1\]\.nextElementSibling\.nodeName\); | |
|
|||
|