Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumJavaScriptcustom iterables Symbol.iteratorSingle-choice MCQ

What happens when this custom iterable is spread twice?

const range = { from: 1, to: 3, [Symbol.iterator]() { let cur = this.from; return { next: () => cur <= this.to ? { value: cur++, done: false } : { value: undefined, done: true } }; } }; console.log([...range].join(',')); console.log([...range].join(','));