Created
September 24, 2014 15:43
-
-
Save mmansion/81478ba3e46b9de5f81f to your computer and use it in GitHub Desktop.
Iterate array multiple times within larger loop
This file contains 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
/* | |
* Iterate array multiple times within a larger loop | |
* | |
*/ | |
var arr = ['one', 'two', 'three']; | |
var xTimes = 20; | |
for(var i =0; i < xTimes; i++) { | |
console.log( arr[i % arr.length] ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment