Premise
Write a function f, that receives an integer n and returns a new Array of size n and which contains in each entry the index i. For example:
f(0) => []
f(3) => [0, 1, 2]
f(5) => [0, 1, 2, 3, 4]
Constraints
- all code in one line
 - max allowed bytes/characters is 36
 - no underscore/lodash/libraries, just vanilla JS
 - ES6 is recommended
 - assume all inputs of 
nto be greater or equal0and lower thanNumber.MAX_SAFE_INTEGER - no performance considerations for this puzzle
 
Spoiler alert
If you like to solve on your own, please avoid the comment section until you solved it or (hopefully not) give up.
Hints
- you should not target for "clean" code
 - omit variable declarations
 - remove any whitespace where you can
 - start with a working implementation and narrow down
 - if you are totally new to this appraoch, try my introduction to one-liners
 
    
Top comments (0)