title: Find second occurrence of a character in a string
body: <p>I have heard that JavaScript has a function called <code>search()</code> that can search for a string ( lets call it A ) in another string ( B ) and it will return the first position at which A was found in B.</p>
  
  <pre><code>var str = "Ana has apples!";
  var n = str.search(" ");
  </code></pre>
  
  <p>The code should return 3 as its the first position in which the space was found in <code>str</code>.</p>
  
  <p>And I was wondering if there is a function that can find the next spaces in my string.</p>
  
  <p>For example I want to find the length of the first word in my string and I could easily do this If I knew the its starting position and its ending one.</p>
  
  <p>If there is such a function, are there any better than it for such things?</p>