title: fastest way performance wise to get last word in a space separated string
body: <p>I'm using jquery to get the last word in a string,
  but i want to be sure it is the best way (performance wise), 
  because the string could get very long</p>
  
  <p>furthermore, i want to add capability to get the "current" word, 
  which may not simply be the last word..</p>
  
  <p>This is my code so far </p>
  
  <pre><code> &lt;script type="text/javascript"&gt;
    function lookup()
    {
      var s = $('#text').val().split( " " ).pop();
      if(!s.length)
        return false;
  
      $('#output').html('"'+s+'"');
    }
    &lt;/script&gt;
  
    &lt;div id="main"&gt;
         &lt;textarea id="text" rows="5" cols="50" onkeyup="lookup(this.value);"&gt;
         &lt;/textarea&gt;
         &lt;div id="output"&gt;&lt;/div&gt;
    &lt;/div&gt;
  </code></pre>
  
  <p>any tips on how i can get it to handle more than just the "last" word, ie, if i move the cursor back a few words to another word, can i still somehow get the current position &amp; then  get that word?</p>