Created
April 27, 2021 11:43
-
-
Save samthomson/7adc9458669a69fae36ccf6bd9f5eeca to your computer and use it in GitHub Desktop.
delta to array index ensuring within bounds
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 newIndex = (items.length + currentIndex + delta) % items.length |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment