usé un console.log para una matriz 3d y este es su contenido
para el segundo su contenido es claro
for(let mmm = 0; mmm < NumOfPatterns;mmm++) { for(let i = 0; i < 36; i++) { for(let j = 0; j < 36; j++) { patterns[mmm][i][j] = 0; console.log(patterns[mmm][i][j]); } } }Uso esta función solo para definir cada valor a 0
Creo que deberías comprobar si existen las matrices:
const NumOfPatterns = 10 const DEFAULT_ARR_LENGTH = 36 let arr3d = [] // checking if the referenced elements exist // if not, create them on the first iteration for (let mmm = 0; mmm < NumOfPatterns; mmm++) { if (typeof arr3d[mmm] === "undefined") arr3d[mmm] = [] for (let i = 0; i < DEFAULT_ARR_LENGTH; i++) { if (typeof arr3d[mmm][i] === "undefined") arr3d[mmm][i] = [] for (let j = 0; j < DEFAULT_ARR_LENGTH; j++) { arr3d[mmm][i].push(0) } } } console.log(arr3d)