Created
April 26, 2019 18:40
-
-
Save dusanmarsa/b975831fd40bd1e06efe7c4403577014 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
/* | |
Loop over array over and over according to its length | |
*/ | |
let array1 = ['a', 'b', 'c', 'd'] | |
let array2 = [...Array(100)].map((i,o) => o) | |
let getByIdx = idx => array1[idx - array1.length * (~~(idx / array1.length))]) | |
array2.forEach(getByIdx) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment