Looping infinitely around an array in JavaScript

Let’s say you have an array of items. They might be colours, pieces of text, DOM nodes, whatever. However, you want to loop around them infinitely. To further exemplify, if you have an array of 8 items, and you are currently on item 2 and you skip alon…


This content originally appeared on Ben Frain and was authored by Ben Frain

Let’s say you have an array of items. They might be colours, pieces of text, DOM nodes, whatever. However, you want to loop around them infinitely. To further exemplify, if you have an array of 8 items, and you are currently on item 2 and you skip along 10, we want to end up back […]


This content originally appeared on Ben Frain and was authored by Ben Frain


Print Share Comment Cite Upload Translate Updates
APA

Ben Frain | Sciencx (2019-03-01T11:44:44+00:00) Looping infinitely around an array in JavaScript. Retrieved from https://www.scien.cx/2019/03/01/looping-infinitely-around-an-array-in-javascript/

MLA
" » Looping infinitely around an array in JavaScript." Ben Frain | Sciencx - Friday March 1, 2019, https://www.scien.cx/2019/03/01/looping-infinitely-around-an-array-in-javascript/
HARVARD
Ben Frain | Sciencx Friday March 1, 2019 » Looping infinitely around an array in JavaScript., viewed ,<https://www.scien.cx/2019/03/01/looping-infinitely-around-an-array-in-javascript/>
VANCOUVER
Ben Frain | Sciencx - » Looping infinitely around an array in JavaScript. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2019/03/01/looping-infinitely-around-an-array-in-javascript/
CHICAGO
" » Looping infinitely around an array in JavaScript." Ben Frain | Sciencx - Accessed . https://www.scien.cx/2019/03/01/looping-infinitely-around-an-array-in-javascript/
IEEE
" » Looping infinitely around an array in JavaScript." Ben Frain | Sciencx [Online]. Available: https://www.scien.cx/2019/03/01/looping-infinitely-around-an-array-in-javascript/. [Accessed: ]
rf:citation
» Looping infinitely around an array in JavaScript | Ben Frain | Sciencx | https://www.scien.cx/2019/03/01/looping-infinitely-around-an-array-in-javascript/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.