Node attribute value is returned nodeType
Node Type (nodeType) node name (nodeName) node value (nodeValue)
1 null element node label name
Text text node 3 #text
Comment nodes 8 #comment exegesis of the text
Document node 9 #document null
Attribute Attribute Name Attribute Value Node 2
<! DOCTYPE HTML> <HTML lang = "EN"> <head> <Meta charset = "UTF-. 8"> <title> the Title </ title> </ head> <body> <div class = "Box" A = "10" b = 20 id = "cont" title = " this is a div"> hello <-! this is a comment - >> </ div> </ body> <Script> var Obox = document.querySelector ( ".box") // by operation of element attributes the console.log (obox.attributes); // display element built-in attribute the console.log (obox.attributes [0 ] .class); the console.log (obox.attributes [ . 1 ] II.A); the console.log (obox.attributes [ 2 ]); console.log(obox.attributes[3]); console.log( typeof obox.attributes[3]); console.log(obox.attributes[2]); console.log(obox.attributes[2].nodeName); console.log(obox.attributes[2].nodeValue); console.log(obox.attributes[2].nodeType); console.log(obox.nodeName) console.log(obox.nodeValue) console.log(obox.nodeType) console.log(typeof obox.childNodes[0]) console.log(obox.childNodes[0]) console.log(obox.childNodes[0].nodeName) console.log(obox.childNodes[0] .nodeValue) the console.log (obox.childNodes [ 0 ] .nodeType) the console.log (obox.childNodes [ . 1 ]) the console.log (obox.childNodes [ . 1 ] .nodeName) the console.log (obox.childNodes [ . 1 ] .nodeValue) the console.log (obox.childNodes [ . 1 ] .nodeType) the console.log (Document) the console.log (document.nodeName) the console.log (document.nodeValue) the console.log (document.nodeType) // dummy array: false arrays can be used to traverse the index and length // but can not use the array method // all DOM selector returned array, the array is a pseudo // arguments // // True array: the length and the traverse by indexing both, may use an array of </ Script> </ HTML>