The nodeName property in JavaScript is used to specify the name of a node.
Example
You can try to run the following code to learn how to implement a nodeName property in JavaScript.
<!DOCTYPE html> <html> <body> <h1 id="id1">Tutorials</h1> <p id="id2">Demo Content</p> <p id="id3"></p> <p id="id4"></p> <script> document.getElementById("id3").innerHTML = document.getElementById("id1").nodeName; document.getElementById("id4").innerHTML = document.getElementById("id2").nodeName; </script> </body> </html>