This is the constructor for the group class that acts similarly to a set.
constructor(){
this.list = [];
}
[Symbol.iterator](){
return new GroupIterator(this.list);
}
This should make group objects itterable but I can't find the error.
class GroupIterator{
constructor(group){
this.group = group;
this.position = 0;
}
next(){
let result = {
value: undefined,
done: true,
};
if(this.position >= this.group.list.length){
return result;
}
result.value = group.list[this.position];
result.done = false;
this.position++;
return result;
}
}