You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
344 B
22 lines
344 B
2 months ago
|
'use strict';
|
||
|
|
||
|
/**
|
||
|
* Create an array of numbers.
|
||
|
* @param {number} from
|
||
|
* @param {number} to
|
||
|
* @returns {number[]}
|
||
|
*/
|
||
|
function range(from, to) {
|
||
|
// TODO: make this inlined.
|
||
|
const list = new Array(to - from + 1);
|
||
|
|
||
|
for (let i = 0; i < list.length; i += 1) {
|
||
|
list[i] = from + i;
|
||
|
}
|
||
|
return list;
|
||
|
}
|
||
|
|
||
|
module.exports = {
|
||
|
range,
|
||
|
};
|