x
 
1
<!DOCTYPE html>
2
<html>
3
<body>
4
5
<h1>JavaScript item() Method</h1>
6
<p id="demo"></p>
7
8
<script>
9
    let list = document.body.childNodes;
10
    let txt = list.item(0).nodeName;
11
    document.getElementById("demo").innerHTML = txt;
12
</script>
13
14
</body>
15
</html>