Exactly, I wanted to keep this simple for people not knowing anything about this subject (like me 2 weeks ago =D )
But from there you can go absolutely nuts ! The sky is the limit ! You can actually declare the iteration protocol inside a class, then all your "instances" are iterables.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Very simple if used generator
Number.prototype[Symbol.iterator] = function* () {
for (let i = 1; i <= this; i++) yield i;
};
Exactly, I wanted to keep this simple for people not knowing anything about this subject (like me 2 weeks ago =D )
But from there you can go absolutely nuts ! The sky is the limit ! You can actually declare the iteration protocol inside a class, then all your "instances" are iterables.