Created
October 31, 2022 15:39
-
-
Save ahmedghazi/0167749c0ce65a9e606a71a90c44ecd2 to your computer and use it in GitHub Desktop.
Modulo
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
export const modulo = (n, length) => { | |
n = (n + 1) % length | |
return n | |
} | |
const index = 0 | |
const length = 20 | |
const nextIndex = modulo(index, length) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment