title: Javascript array of quarters in year to single year
body: <p>How do I convert an array of quarters in a year to just a year if all quarters are present &amp; else have quarters data as it is.
  e.g. From array of year quarters like this</p>
  
  <pre><code>['1Q2017', '2Q2017', '3Q2017', '4Q2017', '1Q2018', '2Q2018', '3Q2018']
  </code></pre>
  
  <p>should have like this output </p>
  
  <pre><code>['2017', '1Q2018', '2Q2018', '3Q2018']
  </code></pre>