how to make a 4 dimensional array in JavaScript
/*having the previous array easy to make is very useful*/
function Array2D(x, y){
let arr = Array(x);
for(let i = 0; i < y; i++){
arr[i] = Array(y);
}
return arr;
}
function Array3D(x, y, z){
let arr = Array2D(x, y);
for(let i = 0; i < y; i++){
for(let j = 0; j < z; j++){
arr[i][j] = Array(z);
}
}
return arr;
}
function Array4D(x, y, z, w){
let arr = Array3D(x, y, z);
for(let i = 0; i < x; i++){
for(let j = 0; j < y; j++){
for(let n = 0; n < z; n++){
arr[i][j][n] = Array(w);
}
}
}
return arr;
}
/*making the array*/
let myArray = Array4D(10, 10, 10, 10);
Also in JavaScript:
- como criar uam seessão com jsp
- Javascript get caller function
- javascript tap and hold
- sass variables across files
- js add element to array
- how to store textbox data while typing for chrome extension
- javascript string first letter lowercase
- convert javascript date into excel date
- AAPT: error: resource drawable/ic_stat_icone_app_final_2 (aka com.procam.fleeting.br:drawable/ic_stat_icone_app_final_2) not found.
- js axios progress
- objects are not valid as a react child
- js show span for 5 seconds
- select2 destroy
- js detect screen size change
- how to update react app
- set dynamic route in link react js
- node js http request get parameters
- factorial javascript function
- javascript queryselector
- javascript radio button value if checked
- "rbac" react redux navigation bar
- mdn golang
- terser
- get select option count using jquery