JSFiddle - React, Tailwind, and code Playground

HTML

<div id="1">Hello
    <div id="2">World</div> <a href="#">missing      text Test</a>
I am outside
</div>

JavaScript

var res = $('body  *').contents().map(function () {
    if (this.nodeType == 3 && this.nodeValue.trim() != "") 
        return this.nodeValue.trim().split(/\W+/);
}).get();
console.log(res);