0
Find Mistake
I have been trying to find the mistake for an hour but couldn't. Can you please help me find the mistake in the follwing JavaScript code. JavaScript Code: documentvar matrix = [ [1, 2, 3], [4, 5, 6], [7, 8, 9] ]; for (var i = 0; i < matrix.length; i++) { for (var j = 0; j <= matrix[i].length; j++) { console.log(matrix[i][j]); } } Expected Behavior: Initialize a 2D array matrix with the values [[1, 2, 3], [4, 5, 6], [7, 8, 9]]. Use a nested for loop to iterate over each element of the 2D array. Log each element of the 2D array to the console.
1 Respuesta
+ 5
interesting.... documentvar exists?