let f = length => Array.from({length}).map((v,k) => k);

console.log( f(4) );

console.log( f(10) );