nodeValue property sets or gets the node value of the specified node. The value returned by DOM API, depends on the type of the node.
Let’s start with the following markup
To set the node value of
h1 tag first we need to select the elements
TEXT_NODE as follows
Next, we can use property
nodeValue to set the contents if previously captured
Here is, complete code