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
To target element nodes, you use the keyword _______. | children | children | |
The keyword children is used to create a collection of _______ (one word). | elements | elements | |
A parent element has been assigned to the variable parentElement. Assign the first child of parentElement to a variable, child1. The variable hasn't been declared beforehand. | let child1 = parentElement.children[0]; | letchild1=parentElement\.children\[0\]; | |
An element has been assigned to a variable, el. Assign the element's 8th child to another variable that hasn't been declared beforehand. Make up the name of the variable. | let child8 = el.children[7]; | let[a-z_$][a-zA-Z0-9_$]*=el\.children\[7\]; | |
In a first statement, assign the only ul on the page to a variable. In a second statement, assign the third child of the ul to another variable. Neither variable has been declared beforehand. Make up the names of the variables. | let list = document.querySelector("ul"); let thirdItem = list.children[2]; |
let([a-z_$][a-zA-Z0-9_$]*)=document\.querySelector\(•ul•\);[\r\n]let[a-z_$][a-zA-Z0-9_$]*=\1\.children\[2\]; | |
In a single statement, assign the sixth child of the only table on the page to a variable that hasn't been declared beforehand. Make up the name of the variable. | let el = document.querySelector("table").children[5]; | let[a-z_$][a-zA-Z0-9_$]*=document\.querySelector\(•table•\)\.children\[5\]; | |
In a first statement, assign to the variable target the third paragraph of a div whose ID is "intro". In a second statement, assign the textContent of the paragraph to the variable txt. Neither variable has been declared beforehand. | let target = document.querySelector("#intro").children[2]; let txt = target.textContent; |
lettarget=document\.querySelector\(•#intro•\)\.children\[2\];[\r\n]lettxt=target\.textContent; | |
In a first statement, assign the first paragraph of a div to a variable, which hasn't been declared beforehand. In a second statement, set the textContent of the paragraph to a string. Make up the ID of the div, the name of the variable, and the string. | let target = document.querySelector("#humpty").children[0]; target.textContent = "Hello World!"; |
let([a-z_$][a-zA-Z0-9_$]*)=document\.querySelector\(•#.*•\)\.children\[0\];[\r\n]\1\.textContent=•.*•; | |
|
|||
|