Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

ShimiShimson's solution for Tree Walker

106 views
Skip to first unread message

Szymon Adamczuk

unread,
Apr 21, 2020, 12:07:07 PM4/21/20
to Intro to JavaScript
nextNode = function(node) {
  //...Code goes here to walk to the next node...
  if (node.firstChild) return node.firstChild;
  if (node.nextSibling) return node.nextSibling;
  while (!node.parentNode.nextSibling) node = node.parentNode;
  return node.parentNode.nextSibling;
};

Reply all
Reply to author
Forward
0 new messages