Skip to content

Instantly share code, notes, and snippets.

@valentingavela
Last active July 11, 2019 15:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save valentingavela/f277d5945e4133d444d64e6cec988206 to your computer and use it in GitHub Desktop.
Save valentingavela/f277d5945e4133d444d64e6cec988206 to your computer and use it in GitHub Desktop.
Array Looper generator
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