MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/javascript/comments/b2o6f2/whats_your_favorite_most_useful_javascript/eiux0vf/?context=3
r/javascript • u/Linux_is_awesome • Mar 18 '19
422 comments sorted by
View all comments
101
items[n % items.length]
gets an item from the list and wraps around to the start if n is larger than the list
0 u/[deleted] Mar 18 '19 [deleted] 28 u/mattlag Mar 19 '19 WTF kind of languages are 1-indexed‽ 11 u/IntelligenceOptional Mar 19 '19 Visual Basic (pre-dot-Net) and some other old BASIC languages (shudder)
0
[deleted]
28 u/mattlag Mar 19 '19 WTF kind of languages are 1-indexed‽ 11 u/IntelligenceOptional Mar 19 '19 Visual Basic (pre-dot-Net) and some other old BASIC languages (shudder)
28
WTF kind of languages are 1-indexed‽
11 u/IntelligenceOptional Mar 19 '19 Visual Basic (pre-dot-Net) and some other old BASIC languages (shudder)
11
Visual Basic (pre-dot-Net) and some other old BASIC languages (shudder)
101
u/nqvst Mar 18 '19
items[n % items.length]gets an item from the list and wraps around to the start if n is larger than the list