直接上代码:
const start = 0; // 起始值
const end = 5; // 结束值(不包含)
const array = Array.from(
{ length: (end - start) },
(_, index) => start + index
);
console.log(array);
直接上代码:
const start = 0; // 起始值
const end = 5; // 结束值(不包含)
const array = Array.from(
{ length: (end - start) },
(_, index) => start + index
);
console.log(array);