The nodeName property contains the name of a node.
The nodeName of the element node is the label name
The nodeName of the attribute node is the attribute name
The nodeName of the text node is always #text
The nodeName of the document node is always #document
nodeValue node value
For text nodes, the nodeValue property contains text.
For attribute nodes, the nodeValue attribute contains attribute values.
The nodeValue property is not available for document nodes and element nodes.
The nodeType property returns the type of the node.
The most important node types are:
Element element1 attribute attr2 text text3 comments8 document9 supplement:
Value - Element Type
1-ELEMENT
2-ATTRIBUTE
3-TEXT
4-CDATA
5-ENTITY REFERENCE
6-ENTITY
7-PI (processing instruction)
8-COMMENT
9-DOCUMENT
10-DOCUMENT TYPE
11-DOCUMENT FRAGMENT
12-NOTATION
typeof
Returns a string representing the expression data type, the possible strings are: "number", "string", "boolean", "object", "function" and "undefined"
The above is the entire content of this article. Have you gained a new understanding of these 4 knowledge points? Leave me a message if you have any questions.