Skip to content

Commit f79280e

Browse files
committed
Improvements
1 parent 75d51a2 commit f79280e

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

JavaScript/6-for-of.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ numbers[-10] = 'Value3';
66
numbers.field1 = 'Value1';
77
numbers[5] = 20;
88

9-
for (const i of numbers) {
10-
const value = numbers[i];
11-
console.log(i, typeof i, value);
9+
for (const value of numbers) {
10+
console.log(value, typeof value);
1211
}

JavaScript/8-continue.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
let i = 0;
44
while (i < 10) {
55
i++;
6-
console.log('Hello');
6+
console.log('Hello', i);
77
if (i === 5) continue;
88
console.log('World');
99
}

JavaScript/b-matrix.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@ const res = matrix
1515

1616
console.log(res);
1717

18-
for (const i in matrix) {
19-
const row = matrix[i];
20-
for (const j in row) {
21-
const col = row[j];
22-
console.log(i, j, col);
18+
for (const row of matrix) {
19+
for (const item of row) {
20+
console.log(item);
2321
}
2422
}

0 commit comments

Comments
 (0)