JSFiddle - React, Tailwind, and code Playground

HTML

<span id="mySpan">This is Outside Text<span>This is Inside Text</span>This is Another Outside Text<span>This is Another Inside Text</span></span>

JavaScript

var children=document.getElementById("mySpan").childNodes,
    count=children.length,
    text="";

for (var i=0;i<count;i++) {
    if (children[i].nodeType==3) {
        text+=children[i].nodeValue;
    }
}
document.write(text);