title: how to map any integer to an index in a javascript array
body: <pre><code>const Arr = [0, 1, 2];
  
  for (var i = Number.MIN_SAFE_INTEGER; i &lt;= Number.MAX_SAFE_INTEGER; i += 1) { ... }
  </code></pre>
  
  <p>Need to correlate any given <strong>i</strong> to an appropriate index in <strong>Arr</strong>, so that</p>
  
  <pre><code>i=-3 =&gt; 0
  i=-2 =&gt; 1
  i=-1 =&gt; 2
  i=0 =&gt; 0
  i=1 =&gt; 1
  i=2 =&gt; 2
  i=3 =&gt; 0
  i=4 =&gt; 1
  i=5 =&gt; 2
  </code></pre>
  
  <p>... etc.</p>