Question 69 of 10069%
69

The `range` object below defines a custom [Symbol.iterator] method. What does spreading it into an array log?

const range = {
  from: 1,
  to: 3,
  [Symbol.iterator]() {
    let current = this.from;
    const last = this.to;
    return {
      next() {
        return current <= last
          ? { value: current++, done: false }
          : { value: undefined, done: true };
      },
    };
  },
};

console.log([...range]);
69/100