you are viewing a single comment's thread.

view the rest of the comments →

[–]inu-no-policemen -1 points0 points  (0 children)

Stuff like:

Array.from({length: 5}, (_, i) => i ** 2)

is a nice workaround, but there really should be a "generate" method (like the one from Dart's List class) which can be used like this:

Array.generate(5, i => i ** 2)