1function range(start, end) {
2 /* generate a range : [start, start+1, ..., end-1, end] */
3 var len = end - start + 1;
4 var a = new Array(len);
5 for (let i = 0; i < len; i++) a[i] = start + i;
6 return a;
7}
1
2function range(start, end, interval = 0) {
3 let arr = [];
4 interval = interval > 0 ? interval-1 : 0
5 for (let i = start; i < end; i++) {
6 arr.push(i)
7 i+=interval;
8 }
9 return arr
10 }
11// example range(0 , 100 , 5)