title: Is there a way to create an array of individual words from innerText via JavaScript?
body: <p>I have a string that looks something like this:</p>
  
  <pre><code>&lt;strong&gt;word&lt;/strong&gt;: or &lt;em&gt;word&lt;/em&gt; or &lt;p&gt;&lt;strong&gt;word&lt;/strong&gt;: this is a sentence&lt;/p&gt; etc...
  </code></pre>
  
  <p>I am trying to parse each string into an array without the html element.<br>
  For example the string: </p>
  
  <pre><code>&lt;strong&gt;word&lt;/strong&gt;
  </code></pre>
  
  <p>should end up being an array that looks like this: </p>
  
  <pre><code>['word', ':']
  </code></pre>
  
  <p>The string:</p>
  
  <pre><code>&lt;p&gt;&lt;strong&gt;word&lt;/strong&gt;: this is a sentence&lt;/p&gt;
  </code></pre>
  
  <p>should end up being an array that looks like this: </p>
  
  <pre><code>['word', ':', 'this', 'is', 'a', 'sentence']      
  </code></pre>
  
  <p>Is there anyway to do this via Javascript?
  My code below is creating an array of individual characters rather than words separated by spaces.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>//w = the string I want to parse
  var p = document.querySelector("p").innerText;
  
  var result = p.split(' ').map(function(w) {
    if (w === '')
      return w;
    else {
      var tempDivElement = document.createElement("div");
      tempDivElement.innerHTML = w;
  
      const wordArr = Array.from(tempDivElement.textContent);
      return wordArr;
    }
  });
  console.log(result)</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;p&gt;&lt;strong&gt;word&lt;/strong&gt;: this is a sentence&lt;/p&gt;</code></pre>
  </div>
  </div>
  </p>