title: Javascript sort alphabetically matching the beginning of string then alphabetically for contained text
body: <p>I need help sorting through some data. 
  Say I type "piz" in a searchfield. I get in return and array with all the entries that contain "piz".</p>
  
  <p>I now want to display them in the following order:</p>
  
  <pre><code>pizza 
  pizzeria
  apizzetto
  berpizzo
  </code></pre>
  
  <p>First the items that start with what I typed in alphabetical order then the ones that contain what I typed in alphabetical order. </p>
  
  <p>Instead if I sort them alphabetically I get the following</p>
  
  <pre><code>apizzetto
  berpizzo
  pizza 
  pizzeria
  </code></pre>
  
  <p>Does anyone know how to do this? 
  Thanks for your help. </p>