Tableaux multidimensionnels

Une variable de type tableau peut aussi servir à stocker d'autres variables de type tableau !!!!

let matrix = [
    [1, 2, 3],
    [4, 5, 6],
    [7, 8, 9]
];
console.log(matrix[0][0]); // Affiche 1
console.log(matrix[1][2]); // Affiche 6
console.log(matrix[2][1]); // Affiche 8

Last updated