title: javascript rotate array elements
body: <p>Hello, everybody, I have this task:
  I have an array [4,7,3,6,9] and I have to make an array like this:</p>
  
  <pre><code>[4,7,3,6,9]
  [9,4,7,3,6]
  [6,9,4,7,3]
  [3,6,9,4,7]
  [7,3,6,9,4]
  </code></pre>
  
  <p>I have to make a program where array is rotating even if I add a new item to an array it should change accordingly. I am total newbie at JS, 1 week or so, here is my current try:</p>
  
  <pre><code>var numbers = [4, 7, 3, 6, 9];
  console.log(numbers);
  numbers[0] = 9; numbers[1] = 4; numbers[2] = 7; numbers[3] = 3; numbers[4] = 6;
  console.log(numbers);
  numbers[0] = 6; numbers[1] = 9; numbers[2] = 4; numbers[3] = 7; numbers[4] = 3;
  console.log(numbers);
  numbers[0] = 3; numbers[1] = 6; numbers[2] = 9; numbers[3] = 4; numbers[4] = 7;
  console.log(numbers);
  numbers[0] = 7; numbers[1] = 3; numbers[2] = 6; numbers[3] = 9; numbers[4] = 4;
  console.log(numbers);
  </code></pre>
  
  <p>Also in my mind I have .push, .splice, etc. I dont know why but i really feel that javascript is not for my brain, haha :D</p>