input 5 then create 5 arrays in runtime .
But can do it using runtime ?
const n=5 //it's a my input
For (var i=0 , i < n, i++){
var unique_array_name = array + i.toString()
unique_array_name =[]
}
I know this above code wrong
const n = 5 const arrays = [] for (let i = 0; i < n; i++) { arrays.push([]) } Now you have n (empty) arrays in the arrays variable.
const n = 5 const arrays = new Array(n)
Обсуждают сегодня