Last active
July 11, 2019 15:18
-
-
Save valentingavela/f277d5945e4133d444d64e6cec988206 to your computer and use it in GitHub Desktop.
Array Looper generator
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
function* arrayLooper(arr = []) { | |
let i = 0; | |
while (1) { | |
i = i === arr.length ? 0 : i; | |
yield arr[i]; | |
i++; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment