title: Get first word of string
body: <p>Okay, here is my code with details of what I have tried to do:</p>
  
  <pre><code>var str = "Hello m|sss sss|mmm ss";
  //Now I separate them by "|"
  var str1 = str.split("|");
  
  //Now I want to get the first word of every split-ed sting parts:
  
  for (var i = 0; i &lt; codelines.length; i++) {
    //What to do here to get the first word of every spilt
  }
  </code></pre>
  
  <p>So what should I do there? :\</p>
  
  <p>What I want to get is :</p>
  
  <ul>
  <li><p><code>firstword[0]</code> will give <code>"Hello"</code></p></li>
  <li><p><code>firstword[1]</code> will give <code>"sss"</code></p></li>
  <li><code>firstword[2]</code> will give <code>"mmm"</code></li>
  </ul>