Codehs 8.1.5 Manipulating 2d Arrays ^hot^ 90%
console.log(array); // Output: // [ // [1, 2, 3, 0], // [4, 10, 6, 0], // [7, 8, 9, 0] // ]
In the meantime, here's a general guide to common tasks in CodeHS 8.1.5 style problems:
Run the autograder to see if your output matches the expected result. Codehs 8.1.5 Manipulating 2d Arrays
for (int row = 0; row < studentScores.length && !found; row++) for (int col = 0; col < studentScores[row].length && !found; col++) if (studentScores[row][col] == targetScore) found = true;
💡 Always remember that array.length gives you the number of rows, while array[0].length gives you the number of columns. If you'd like, I can help you further if you tell me: console
// Modifying an element array[1][1] = 10; console.log(array[1][1]); // Output: 10
Avoid generic variables. Use row and col instead of i and j to drastically reduce typos. Use row and col instead of i and
Removing a row from a 2D array can be done using the splice() method.