Created
December 10, 2013 14:38
-
-
Save davedx/7891611 to your computer and use it in GitHub Desktop.
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
// cycle through "myArray" in "dir" (-1 or +1), wrapping around | |
var nextIdx = (currentIdx + dir) % myArray.length; | |
if(nextIdx < 0) nextIdx = myArray.length - 1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment