Skip to content

Commit 582270f

Browse files
committed
Improve naming
1 parent 982578e commit 582270f

File tree

5 files changed

+19
-18
lines changed

5 files changed

+19
-18
lines changed

JavaScript/4-for-in.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
'use strict';
22

3-
const arr = [7, 10, 1, 5, 2];
4-
arr.field = 'Value';
3+
const numbers = [7, 10, 1, 5, 2];
4+
numbers.field = 'Value';
55

6-
for (const i in arr) {
7-
const value = arr[i];
6+
for (const i in numbers) {
7+
const value = numbers[i];
88
console.log(i, value);
99
}
1010

1111
let j, value;
12-
for (j in arr) {
13-
value = arr[j];
12+
for (j in numbers) {
13+
value = numbers[j];
1414
console.log(j, value);
1515
}

JavaScript/5-for-of.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
'use strict';
22

3-
const arr = [7, 10, 1, 5, 2];
4-
arr.field = 'Value';
3+
const numbers = [7, 10, 1, 5, 2];
4+
numbers.field = 'Value';
55

6-
for (const i of arr) {
6+
for (const i of numbers) {
77
console.log(i);
88
}

JavaScript/6-break.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,3 @@ label1: {
1111
break label2;
1212
}
1313
}
14-

JavaScript/8-forEach.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
'use strict';
22

3-
const a = [7, 10, 1, 5, 2];
3+
const numbers = [7, 10, 1, 5, 2];
44

5-
a.forEach((item, i, arr) => {
5+
numbers.forEach((item, i, arr) => {
66
console.log(i, arr, item);
77
});
88

9-
console.log();
10-
11-
[7, 10, 1].forEach(console.log);
12-
13-
console.log();
9+
[7, 10, 1].forEach(x => {
10+
console.log(x);
11+
});
1412

1513
[7, 10, 1].forEach(x => console.log(x));
14+
15+
[7, 10, 1].forEach(console.log);

JavaScript/9-map.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
'use strict';
22

3-
const log = s => console.log(s);
3+
const log = s => {
4+
console.log(s);
5+
};
46

57
[7, 10, 1, 5, 2].map(x => x * 2).map(log);

0 commit comments

Comments
 (0)