forked from and-digital/and-workshop-corejs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path01_variables.test.js
52 lines (42 loc) · 910 Bytes
/
01_variables.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
describe("About variables", () => {
it('should understand VAR', () => {
var x = 5;
var x = 6;
expect(x).toBe(5);
});
it('should understand the difference of LET and VAR', () => {
var x = 6;
let x = 5;
expect(x).toBe(5);
});
it('should understand LET', () => {
let x = 5;
let x = 6;
expect(x).toBe(6);
});
it('should understand LET scoping', () => {
let x = 5;
function foo() {
let x = 20;
return x;
}
expect(x).toBe(20);
});
it('should understand CONST - scalar values', () => {
const x = 5;
x = 'foo';
expect(x).toBe(5);
});
it('should understand CONST - assignment', () => {
const x;
x = 5
expect(x).toBe(5);
});
it('should understand CONST - objects', () => {
const person = {
"name": "Linus",
"age": 42
};
expect(person.lastname).toBe('torvalds');
});
});