Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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)
    }
 
PREVIOUS NEXT
Tagged: #array #number #length
ADD COMMENT
Topic
Name
8+4 =