title: How to access array in circular manner in JavaScript
body: <p>I have an array like <code>[A,B,C,D]</code>. I want to access that array within a for loop like as</p>
  <pre><code>var arr = [A,B,C,D];
  
  var len = arr.length;
  for(var i = 0; i&lt;len; i++){
      0 - A,B,C
      1 - B,C,D
      2 - C,D,A
      3 - D,A,B
  }
  </code></pre>
  <p>I want to access that like in JavaScript, any ideas?</p>