When working with a DOM tree, you can also use the following methods:

  • node.getChildNodes() returns the number of child nodes of a given node.
  • node.getFirstChild() returns the first child node of a given node.
  • node.getLastChild() returns the last child node of a given node.