To add a new row to a 2D array, you can use the push() method.
return sum;
The standard traversal pattern uses the length of the array to determine the number of rows and the length of the first row to determine the number of columns:
, and I'll write the complete code solution for you.
Many students assume 5x5 or 4x4. Always use matrix.length and matrix[0].length so your code works for any rectangle.
Master Thorne stared at the grid, then at her. He didn’t smile. He never smiled. But he nodded once, slowly.
// myArray = [[1, 2, 3, 1], [4, 5, 6, 2], [7, 8, 9, 3]];
To add a new row to a 2D array, you can use the push() method.
return sum;
The standard traversal pattern uses the length of the array to determine the number of rows and the length of the first row to determine the number of columns: Codehs 8.1.5 Manipulating 2d Arrays
, and I'll write the complete code solution for you. To add a new row to a 2D
Many students assume 5x5 or 4x4. Always use matrix.length and matrix[0].length so your code works for any rectangle. slowly. // myArray = [[1
Master Thorne stared at the grid, then at her. He didn’t smile. He never smiled. But he nodded once, slowly.
// myArray = [[1, 2, 3, 1], [4, 5, 6, 2], [7, 8, 9, 3]];