Skip to content

Commit ffb0947

Browse files
committed
Improve examples code style
1 parent 0f4b880 commit ffb0947

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

JavaScript/4-introspection.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ console.log('Arguments: ');
2121
console.dir({
2222
inc: inc.length,
2323
sum: sum.length,
24-
max: max.length
24+
max: max.length,
2525
});
2626

2727
console.log('Anonymous function: ' + function(x) { return x; }.name);
@@ -31,5 +31,5 @@ console.log('toString: ');
3131
console.dir({
3232
inc: inc.toString(),
3333
sum: sum.toString(),
34-
max: max.toString()
34+
max: max.toString(),
3535
});

JavaScript/6-rest.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ f1(1, 2, 3);
88

99
const f2 = (...args) => {
1010
args.forEach(arg => {
11-
console.log('Type: ' + typeof arg);
12-
if (typeof arg === 'object') {
11+
const type = typeof arg;
12+
console.log('Type: ' + type);
13+
if (type === 'object') {
1314
console.log('Value: ' + JSON.stringify(arg));
1415
} else {
1516
console.log('Value: ' + arg);

JavaScript/7-new.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ const sum = new Function('a, b', 'return a + b');
55
console.dir({
66
name: sum.name,
77
length: sum.length,
8-
toString: sum.toString()
8+
toString: sum.toString(),
99
});

0 commit comments

Comments
 (0)