Which property gives the name of a DOM node?
A
nodeValue B
nodeName C
tagName D
elementName
Analysis & Theory
`nodeName` returns the name of the node, such as `DIV`, `#text`, or `#comment`.
Which property returns the type of a node as a number?
A
nodeType B
nodeValue C
nodeKind D
nodeIndex
Analysis & Theory
`nodeType` returns a numeric code representing the type of node (e.g., 1 for element, 3 for text).
What is the `nodeValue` of an element node?
A
The tag name B
The innerHTML C
null D
The class name
Analysis & Theory
For element nodes, `nodeValue` is `null`. It is only meaningful for text, attribute, and comment nodes.
Which nodeType value corresponds to an Element node?
A
1 B
2 C
3 D
8
Analysis & Theory
`nodeType === 1` represents an element node.
What value does `nodeType` return for a Text node?
A
1 B
2 C
3 D
8
Analysis & Theory
Text nodes have a `nodeType` value of `3`.
Which property is used to access or modify the textual content of a Text node?
A
text B
innerText C
nodeText D
nodeValue
Analysis & Theory
`nodeValue` holds the text content of text or comment nodes.
What does `nodeName` return for a Text node?
A
#text B
TEXT C
null D
innerText
Analysis & Theory
`nodeName` for a Text node is `#text`.
Which nodeType value represents a Comment node?
A
1 B
2 C
3 D
8
Analysis & Theory
`nodeType === 8` indicates a Comment node.
How do you access the parent of a given DOM node?
A
node.parentElement B
node.parentNode C
node.parent D
node.owner
Analysis & Theory
`parentNode` returns the parent of a given DOM node.
Which property returns all child nodes, including text and comment nodes?
A
children B
childElements C
childNodes D
allNodes
Analysis & Theory
`childNodes` returns all child nodes (elements, text, comments, etc.) as a NodeList.