Answers for "how to get array from number length"

1

how to get array from number length

//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)
    }
Posted by: Guest on August-26-2021

Code answers related to "how to get array from number length"

Code answers related to "Javascript"

Browse Popular Code Answers by Language