Created
November 21, 2019 02:11
-
-
Save evanwinter/c65ead4ef9e4c002086e33fe22481652 to your computer and use it in GitHub Desktop.
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
const array = ['a', 'b', 'c'] | |
const current = 0 | |
const last = array.length - 1 | |
const prev = (current === 0) ? last : current-1 | |
const next = (current === last) ? 0 : current+1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment