Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

My solution to Tree Walker Exercise

97 views
Skip to first unread message

Ming Wei

unread,
Jan 3, 2020, 10:59:56 AM1/3/20
to Intro to JavaScript
nextNode = function(node) {
  if (node.firstChild) {
    return node.firstChild;
  }
  while (node && !node.nextSibling) {
    node = node.parentNode;
  }
  if (node) {
    node = node.nextSibling;
  }
  return node;
};
Reply all
Reply to author
Forward
0 new messages