Skip to content

Commit a859b9e

Browse files
committed
code style fixed
1 parent e467fb6 commit a859b9e

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

Diff for: Recursive/MultiDimensionalArrayPrint.js

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
function printElements(arr) {
2-
for (let i = 0; i < arr.length; i++) {
3-
if (Array.isArray(arr[i])) {
4-
// Recursive case: if the element is an array, go deeper
5-
printElements(arr[i]);
6-
} else {
7-
// Base case: if the element is not an array, print it
8-
console.log(arr[i]);
9-
}
2+
for (let i = 0; i < arr.length; i++) {
3+
if (Array.isArray(arr[i])) {
4+
// Recursive case: if the element is an array, go deeper
5+
printElements(arr[i])
6+
} else {
7+
// Base case: if the element is not an array, print it
8+
console.log(arr[i])
109
}
10+
}
1111
}
1212
const multiDimensionalArray = [
13-
[1, 2, [3, 4]],
14-
[5, 6],
15-
[[7, 8], 9]
16-
];
13+
[1, 2, [3, 4]],
14+
[5, 6],
15+
[[7, 8], 9]
16+
]
1717

18-
printElements(multiDimensionalArray);
18+
printElements(multiDimensionalArray)

0 commit comments

Comments
 (0)