All challenges

JavaScript challenge · Frontend

Cycle Loop

Difficulty

easy

Time

~15m

Format

Single

Grading

Auto-graded

#frontend#javascript#typescript#generators#functions
Mission file // read carefullyeasy

Implement cycle(...args) that returns a helper function. Each time that helper function is called, it returns the next item in args in a round-robin cycle.

const next = cycle('a', 'b');
next() // => 'a'
next() // => 'b'
next() // => 'a'

Build with

TypeScriptJavaScript
Hidden test suite
Auto-graded on submit
Start challenge

Sign in to save your progress.