Created
April 21, 2016 14:18
-
-
Save rjmacarthy/02493fea68c88238473a8bf0703f6a48 to your computer and use it in GitHub Desktop.
Shift an array.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var arr = [1,2,3,4]; | |
var i = 0, times = 4; | |
while (i < times) { | |
arr.unshift(arr.pop()); | |
console.log(arr); | |
i++; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment