The idea was to console log node value. But instead of names it returns null. I don't see why, because code seems fine to me. So, I want understand what happening. I found how to make it work, but I don't understand why my code don't work. Code and results:
HTML
<div>Users:</div>
<ul id="myList">
<li>John</li>
<li>Doe</li>
</ul>
JavaScript
let listNode = document.body.children[1].children[1]
console.log(listNode)
// Why not return node value?
let value = listNode.nodeValue
console.log(value)
Results:
link
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…