Question: Is there a way to replace the normal text within a table element that is placed within the body of the HTML?

Like replacing "hello" with "hi"?

Please only use **JavaScript** without **jQuery**.

Answer: 
I ended up with this function to safely replace text without side effects (so far):

```
function replaceInText(element, pattern, replacement) {
    for (let node of element.childNodes) {
        switch (node.nodeType) {
            case Node.ELEMENT_NODE:
                replaceInText(node, pattern, replacement);
                break;
            case Node.TEXT_NODE:
                node.textContent = node.textContent.replace(pattern, replacement);
                break;
            case Node.DOCUMENT_NODE:
                replaceInText(node, pattern, replacement);
        }
    }
}

```

It's for cases where the 16kB of [`findAndReplaceDOMText`](https://github.com/padolsey/findAndReplaceDOMText) are a bit too heavy.
I am new to `Javascript` and just started learning these skills. Please check if the below method is useful to replace the text.

```
<script>

    var txt=document.getElementById("demo").innerHTML;
    var pos = txt.replace(/Hello/g, "hi")
    document.getElementById("demo").innerHTML = pos;

</script>

```