Which method is used to compare the placement of two nodes in the DOM hierarchy (document)?
A
compareDocumentPosition()
B
cloneNode()
C
getUserData()
D
getFeature()
Correct Answer: compareDocumentPosition()
The compareDocumentPosition() method is used to compare the placement of two nodes in the DOM hierarchy (document). The return value is an integer value whose bits represent the calling Node’s relationship to otherNode within the Document.