Skip to content

Instantly share code, notes, and snippets.

@mendes5
Created October 26, 2021 14:10
Show Gist options
  • Select an option

  • Save mendes5/e92a43928826de5fdcbbce1714a3c1c2 to your computer and use it in GitHub Desktop.

Select an option

Save mendes5/e92a43928826de5fdcbbce1714a3c1c2 to your computer and use it in GitHub Desktop.
Cursed numbered array builder
Number.prototype[Symbol.iterator] = function*() {
for (let n = 0; n <= this; n++)
yield n;
};
// this: [...4]
// outputs: [0, 1, 2, 3, 4]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment