Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Tree Walker: my solution

114 views
Skip to first unread message

Tyrone Hinderson

unread,
Aug 21, 2021, 6:04:24 PM8/21/21
to Intro to JavaScript
nextNode = function(node) {
  console.log(node)
  if(node.childNodes.length > 0) {
    return node.firstChild;
  }
  var next;
  while(next == null && node != null){
    next = node.nextSibling;
    node = node.parentNode
  }
  return next;
};
Reply all
Reply to author
Forward
0 new messages