title: Grid how to find the index of the first position of the next row given a starting index
body: <pre><code> 0  1  2  3  4
   5  6  7  8  9
  10 11 12 13 14
  </code></pre>
  <p>assume there is an array like a css grid with 15 elements like above, there are five columns and 3 rows, and starting index is 0</p>
  <p>given the index of <strong>any</strong> element, how do you find the index of the first position that is in the next row ?</p>
  <p>for example,</p>
  <p>index 4 returns 5<br />
  index 6 returns 10<br />
  index 2 returns 5<br />
  index 11 returns 15<br />
  index 0 returns 5<br />
  index 14 returns 15</p>
  <p>my formula is <strong>not</strong> working</p>
  <pre><code>const colPosition = index % colCount;
  const rowPosition = Math.floor(index / colCount);
  const answer = index + (colCount - colPosition) + 1;
  </code></pre>