Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Number.prototype[Symbol.iterator] = function() {
- let iterValue = 0;
- const finalValue = this.valueOf();
- return {
- next: () => ({
- done: iterValue === finalValue,
- value: iterValue++,
- }),
- }
- }
- console.log([...8]);
- // >>>Β [0, 1, 2, 3, 4, 5, 6, 7]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement