Skip to content

Commit 0f55c8a

Browse files
committed
Add grammar basics
1 parent 53a760c commit 0f55c8a

File tree

6 files changed

+77
-0
lines changed

6 files changed

+77
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
*.log
3+
.DS_Store

JavaScript/1-comments.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
'use strict';
2+
3+
// Single comment
4+
5+
/*
6+
Multiline
7+
comments
8+
*/

JavaScript/2-const-let.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
'use strict';
2+
3+
console.log({ a });
4+
5+
var a = 5;
6+
let b = 6;
7+
const c = 7;
8+
9+
console.log({ a, b, c });
10+
11+
a = 8;
12+
b = 9;
13+
14+
console.log({ a, b, c });

JavaScript/3-scalar.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
'use strict';
2+
3+
const scalar = 5;
4+
const object1 = { scalar };
5+
const object2 = object1;
6+
7+
object1.scalar = 6;
8+
9+
console.log({ object1 });
10+
console.log({ object2 });
11+
console.dir({ scalar });

JavaScript/4-types.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
'use strict';
2+
3+
const i = 5;
4+
const s = 'Hello';
5+
const b = true;
6+
const f = 10.3;
7+
8+
const o = {
9+
name: 'Marcus Aurelius',
10+
born: 121,
11+
city: 'Roma',
12+
position: 'emperor'
13+
};
14+
15+
const a = ['Athens', 'Roma', 'London', 'Beijing', 'Kiev', 'Riga'];
16+
17+
console.log({ i }, typeof(i));
18+
console.log({ s }, typeof(s));
19+
console.log({ b }, typeof(b));
20+
console.log({ f }, typeof(f));
21+
console.log({ o }, typeof(o));
22+
console.log({ a }, typeof(a));

JavaScript/5-undefined-null-NaN.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
'use strict';
2+
3+
// undefined
4+
5+
let u;
6+
console.log({ u }, typeof(u));
7+
8+
// null
9+
10+
let o = null;
11+
console.log({ o }, typeof(o));
12+
13+
// null
14+
15+
let n = NaN;
16+
console.log({ n }, typeof(n));
17+
18+
n = undefined + 1;
19+
console.log({ n }, typeof(n));

0 commit comments

Comments
 (0)