title: How to replace the last word in a string
body: <p>Does anyone knows how to replace the last word in a String.</p>
  
  <p><strong>Currently I am doing:</strong></p>
  
  <pre><code>someStr = someStr.replace(someStr.substring(someStr.lastIndexOf(" ") + 1), "New Word");
  </code></pre>
  
  <p>The above code replaces every single occurance of the word in the string. </p>
  
  <p>Thanks.</p>