-
Notifications
You must be signed in to change notification settings - Fork 0
/
02_values.js
31 lines (22 loc) · 781 Bytes
/
02_values.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
/*-----------------------------------------------------------------------------*/
/* Primitive
-------------------------------------------------------------------------------*/
// let a = 42;
// let b = a;
// b++;
// console.log("a", a); // 42
// console.log("b", b); // 43
/*-----------------------------------------------------------------------------*/
/* Reference
-------------------------------------------------------------------------------*/
let a = [1, 2, 3];
let b = a;
// let b = a.concat(); // clones array
b.push(4)
// console.log("a", a);
// console.log("b", b);
let c = [1, 2, 3, 4];
// console.log(a === c); // false even though they have the same content
let testArr1 = [1, 2, 3];
let testArr2 = [1, 2, 3];
console.log(testArr1 === testArr2); // false