Code
Loading editor...
Tap Analyze to see visualization
Click Analyze to visualize
See step-by-step execution, variables, and output
Variables
Run code to see variables
Output
Console output will appear here
Click Analyze to visualize
See step-by-step execution, variables, and output
Run code to see variables
Console output will appear here
Traverse the tree recursively, adding each node's tag name (lowercased) to a Set to collect unique values. Sort the Set into an array for the final result. Extend with a counting variant that uses an object to tally occurrences of each tag.
A Set automatically deduplicates tag names during traversal, and lowercasing before insertion ensures case-insensitive uniqueness across mixed-case DOM trees.
Updated Feb 2026