Advanced JavaScript Training
Multi-Dimensional Arrays

Multi-Dimensional Arrays

  <p class='lg:w-1/2 w-full leading-relaxed text-gray-500 w-1/2 p-0.5' style='text-align: left; margin-right: 1in;'>
      <p style='text-align: left;'> Arrays in JavaScript can also be multi-dimensional, meaning they can contain other arrays as elements. This is often used to represent grids, tables, or matrices.</p>
  
    let grid = [
    [1, 2, 3],
    [4, 5, 6],
    [7, 8, 9]
 ];
 console.log(grid[1][2]); // Accessing the value 6
 
Have a doubt?
Post it here, our mentors will help you out.