Skip to content

Commit 6201f3f

Browse files
committed
Improve naming
1 parent bb6ef84 commit 6201f3f

File tree

4 files changed

+41
-34
lines changed

4 files changed

+41
-34
lines changed

JavaScript/2-const-let.js

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

3-
console.dir({ a });
3+
console.dir({ bubbleEffect });
44

5-
var a = 5;
6-
let b = 6;
7-
const c = 7;
8-
9-
const o = { a, b, c };
5+
var bubbleEffect = 5;
6+
let scalarVariable = 6;
7+
const scalarConstant = 7;
108

9+
const o = { scalarVariable, scalarConstant };
1110
console.dir(o);
1211

13-
a = 8;
14-
b = 9;
12+
o.scalarVariable = 8;
13+
scalarVariable = 9;
1514

1615
console.dir(o);

JavaScript/3-scalar.js

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

3-
const scalar = 5;
4-
const object1 = { field: scalar };
3+
const scalar1 = 5;
4+
const scalar2 = scalar1;
5+
6+
const object1 = { field: scalar1 };
57
const object2 = object1;
68

79
console.dir({ object1 });
810
console.dir({ object2 });
9-
console.dir({ scalar });
11+
console.dir({ scalar1 });
1012

1113
object1.field = 6;
1214

1315
console.dir({ object1 });
1416
console.dir({ object2 });
15-
console.dir({ scalar });
17+
console.dir({ scalar1 });

JavaScript/4-types.js

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,32 @@ const f = 10.3;
55
const s = 'Hello';
66
const b = true;
77

8-
const o = {
8+
const person = {
99
name: 'Marcus Aurelius',
1010
born: 121,
1111
city: 'Roma',
1212
position: 'emperor'
1313
};
1414

15-
o.city = 'Odessa';
15+
person.city = 'Odessa';
1616

17-
const a = ['Athens', 'Roma', 'London', 'Beijing', 'Kiev', 'Riga'];
17+
const cities = ['Athens', 'Roma', 'London', 'Beijing', 'Kiev', 'Riga'];
1818

19-
a.push('Odessa');
20-
a.unshift('New York');
19+
cities.push('Odessa');
20+
cities.unshift('New York');
2121

22-
console.log('shifted:' + a.shift());
23-
console.log('pop: ' + a.pop());
22+
console.log('shift: ' + cities.shift());
23+
console.log('pop: ' + cities.pop());
2424

2525
console.log({ i }, typeof(i));
2626
console.log({ s }, typeof(s));
2727
console.log({ b }, typeof(b));
2828
console.log({ f }, typeof(f));
29-
console.log({ o }, typeof(o), { isArray: Array.isArray(o) });
30-
console.log({ a }, typeof(a), { isArray: Array.isArray(a) });
31-
console.log({ a }, { instanceofArray: a instanceof Array });
29+
30+
console.log({ person }, typeof(person));
31+
console.log({ isArray: Array.isArray(person) });
32+
33+
console.log({ cities }, typeof(cities));
34+
console.log({ isArray: Array.isArray(cities) });
35+
36+
console.log({ instanceofArray: cities instanceof Array });

JavaScript/5-undefined-null-NaN.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
11
'use strict';
22

33
// undefined
4-
5-
let u;
6-
console.log({ u }, typeof(u));
4+
let emptyScalar;
5+
console.log({ emptyScalar }, typeof(emptyScalar));
76

87
// null
9-
10-
const o = null;
11-
console.log({ o }, typeof(o));
8+
const enptyObject = null;
9+
console.log({ enptyObject }, typeof(enptyObject));
1210

1311
// NaN
12+
let count = NaN;
13+
console.log({ count }, typeof(count));
1414

15-
let n = NaN;
16-
console.log({ n }, typeof(n));
17-
18-
n = undefined + 1;
19-
console.log(n);
15+
count = undefined + 1;
16+
console.dir({ count });
2017

2118
console.log(Infinity, -Infinity, typeof(Infinity));
2219

23-
const s = o === null ? 'o is null' : 'o is not null';
20+
const s = (
21+
enptyObject === null ?
22+
'enptyObject is null' :
23+
'enptyObject is not null'
24+
);
2425
console.log(s);

0 commit comments

Comments
 (0)