MCQ PracticeSingle Best AnswerTopic: Javascript DOM & Event Handling MCQ
Q
Which technique is used to compare the positions of two nodes within a DOM document?
Question ID
#5191
Subchapter
Javascript DOM & Event Handling MCQ
Action
Choose one option below
Choose Your Answer
Click an option to check whether your answer is correct.
A
compareDocumentPosition()
✔✖
B
cloneNode()
✔✖
C
getUserData()
✔✖
D
getFeature() ✔✖
A
Correct Answer: A
Explanation
To compare the positions of two nodes in the DOM hierarchy, use the compareDocumentPosition() function (document).
The returned response is an integer whose bits denote the relationship between the caller node and other nodes in the document.