title: Javascript replace value to increment number
body: <p>i'm trying to achieve something using Javascript, my current condition is ,i have array that has same value, i need to replace the value to increment number if the value are same.</p>
  <p>Here is my sample code</p>
  <pre><code>var period = ['202001', '202001', '202001', '202002', '202002', '202003', '202003', ...];
  </code></pre>
  <p>The result i'm expecting is</p>
  <pre><code>var period = ['0', '0', '0', '1', '1', '2', '2'];
  </code></pre>
  <p>The real  case is, i want to produce a heatmap using highcharts, but i need to convert the year-month into xy coordinates.</p>
  <p>Do you have any best suggestion about how do i solve this ?<br>
  Many Thanks...</p>