Created
December 23, 2020 11:38
-
-
Save davidsharp/fe2fd4356e5e6c992e9f0eeddbdd5982 to your computer and use it in GitHub Desktop.
Quick little function for getting indexes in arrays cyclically (-1 = last element, length+1 = first element)
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
| const getIndex = (array,index) => array[(array.length+index)%array.length] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment