Node name in JavaScript
All nodes have the property nodeName.
For a comment, it contains the value 'comment',
for a text node, the value 'text', and for an
element node, the tag name in uppercase. It turns out
that nodeName for elements is similar to the property
tagName,
but works for other types of nodes as well.
Given a div:
<div id="elem">txt<b>tag</b><!--com-->txt<b>tag</b><!--com--></div>
Loop through all the nodes of this div and print their names to the console.