back to series Implement a cycleOn function
cycleOn is a higher order utility function which helps you cycle through a list of values.
The generic implementation of cycleOn utility and can be extended to create other similar utilities like toggleOn (for two values).
Variation: Basic implementation
Variation: Toggle onUsually cycleOn with only two values is referred as toggleOn, where you toggle between two state values.
I strongly encourage you to explore and tackle additional questions in my Closure Questions for Frontend Interviews blog series.
By doing so, you can enhance your understanding and proficiency with closures, preparing you to excel in your upcoming frontend interviews.
Wishing you best. Happy Interviewing 🫡.