title: Appending the count to duplicates in a javascript string array
body: <p>I am trying to append the count to duplicate entries in a string array. I have an array like this which contains duplicate entries. </p>
  
  <pre><code>var myarray = ["John", "John", "John", "Doe", "Doe", "Smith", 
                 "John", "Doe", "Joe"];
  </code></pre>
  
  <p>My desired output is</p>
  
  <pre><code>var newArray = ["John - 1", "John - 2", "John - 3", "Doe - 1", 
                  "Doe - 2", "Smith", "John - 4", "Doe - 3", "Joe"];
  </code></pre>
  
  <p>What is the best way to do this? </p>