function Words(string) {
this.str = string;
}
Words.prototype[Symbol.iterator] = () => {
let i = -1;
return {
next() {
i++;
console.log(this.str);
if (i > this.str.length - 1) {
return { value: undefined, done: true };
}
return { value: this.str[i], done: false };
},
};
};