loading
open in
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
let lodashRange = require('lodash.range');

console.log(lodashRange(4));
console.log(lodashRange(-4));
console.log(lodashRange(1, 5));
console.log(lodashRange(0, 20, 5));

console.log([...Array(4).keys()]);

Array.from({ length: 4 }, (_, i) => i);
Array.from({ length: 4 }, (_, i) => i > 1 ? -i : i);
Array.from({ length: 4 }, (_, i) => i + 1);
Array.from({ length: 4 }, (_, i) => i * 5);
Native Browser JavaScript