logo
logo

DOM Traversal

DOM Traversal

Write a function that takes a DOM element as a parameter and logs its tag name and the tag names of its children to the console. The function should also recursively call itself on each child element. For example, if the function is called with the body element, it should log "BODY" and the tag names of all of its child elements.

Console
Submit
Solution
00:00