iter[Symbol.iterator code example
Example: [symbol.iterator]
const iterable1 = {};
iterable1[Symbol.iterator] = function* () {
yield 1;
yield 2;
yield 3;
};
console.log([...iterable1]);
// expected output: Array [1, 2, 3]
const iterable1 = {};
iterable1[Symbol.iterator] = function* () {
yield 1;
yield 2;
yield 3;
};
console.log([...iterable1]);
// expected output: Array [1, 2, 3]