NamasteScale needs JavaScript to run. Enable it to practise system design, low level design and machine coding.
for...of works on anything that follows the iteration protocol: an object with a [Symbol.iterator]() method that returns { next() }. Generators are the easiest way to write such iterators, and they can pause and resume.