const obj = {
data: ['x', 'y', 'z'],
*[Symbol.iterator]() {
for (let i = this.data.length - 1; i >= 0; i--) {
yield this.data[i].toUpperCase();
}
}
};
const result = [];
for (const item of obj) {
result.push(item);
if (result.length === 2) break;
}
console.log(result.join('-')); Post #2947
3.35K
CHALLENGE
- ❤ 13
- 👍 3
- 🔥 1