Implement a function that cycles through a sequence of values each time it is called.
Arguments:
Returns:
value: the current value in the sequence.cycle: a function that moves to the next value in the sequence.Examples:
const [state, cycle] = useCycle("low", "medium", "high"); console.log(state); // "low" cycle(); console.log(state); // "medium" cycle(); console.log(state); // "high" cycle(); console.log(state); // "low"
JavaScript Function
No test results yet
Click "Run" to execute tests