📜  如何从数字长度获取数组 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:54.858000             🧑  作者: Mango

代码示例1
//here is how to get an array from the length of a number
// for example you want to get [1,2,3,4,5] from the integer 5.

let arr = []
let i = 5
for (let j = 0 ; j < i + 1 ; j++ ) {
    arr.push(j)
    }