title: Javascript - Splicing strings from certain character to next character
body: <p>Hopefully a basic question, as I'm a bit lost where to begin.</p>
  
  <p>Pretend we have this string in JS:</p>
  
  <p>var foo = <strong>"Yes, today #hello #vcc #toomanyhashtags #test we went to the park and danced"</strong></p>
  
  <p>How would I go about dynamically finding the character "#" and removing everything after until it hits a space <em>(or in the instance of <strong>#test</strong>, until the string ends)</em>?</p>
  
  <p>ie. So the above string would read:</p>
  
  <p>var foo = <strong>"Yes, today we went to the park and danced "</strong></p>
  
  <p>I had the concept to loop through the entire strings' characters and <code>if</code> the character === "#", delete characters until the current loop's item === " ". Is there a shorter way to do this?</p>
  
  <h2>Preliminary Concept:</h2>
  
  <pre><code>var foo = "Hello, this is my test #test #hello";
  var stripHashtags = function(x) {
      for (i=0; i &lt; x.length; i++) {
          if (x[i] !== "#") {
              console.log(x[i]);
          }
      }
  };
  stripHashtags(foo);
  </code></pre>