# Thread - 變數、型別、記憶體空間 題目整理
1.
```
// 1. console.log 的值為?
// 2.出現幾個變數、型別、記憶體空間?
let a ;
a = 1;
a = "hello";
console.log(a)
```
2.
```
// 1. console.log 值為?
// 2.出現幾個變數、型別、記憶體空間?
let b = 3 ;
b=5;
let c = 4;
b=8;
c=c+b;
let d = b+c;
console.log(e)
```
3.
```
// 1. console.log 值為?
// 2. 出現幾個變數、型別、記憶體空間?
let e=0;
e = 5;
e = "hello"
e = true;
e = 3;
e+=1;
console.log(e)
```
4.
```
// 1. console.log 值為?
// 2. 出現幾個變數、型別、記憶體空間?
let f = 1;
f++ ;
f=true;
f=10;
let g = 5;
g+=5;
let h = f+g
console.log(h)
```
5.
```
// 1. console.log 值為?
// 2. 出現幾個變數、型別、記憶體空間?
let a = 7;
a+=7;
a=7;
let b = 5;
b=a;
let c = a+b
console.log(c)
```
6.
```
// 1. console.log 值為?
// 2. 出現幾個變數、型別、記憶體空間?
let a = 1;
let b = a++;
let c = a+b;
let d = '3';
c = c + d;
console.log(c);
```
7.
```
// 1. console.log 值為?
// 2. 出現幾個變數、型別、記憶體空間?
let x = "false"
x = false
let y = -1
y++
let z = x*y
console.log((z+y+true)*x)
```
8.
```
// 1. console.log 值為?
// 2. 出現幾個變數、型別、記憶體空間?
let a = 2;
let b = "Hello"
let c = a + b;
let d = true;
let e = c+d
console.log(e);
```
9.
```
// 1. console.log 值為?
// 2. 出現幾個變數、型別、記憶體空間?
let a = 3;
let b = a + 3;
c ++;
b = '6';
let d = 'false';
console.log(a+b);
```
10.
```
// 1. console.log 值為?
// 2. 出現幾個變數、型別、記憶體空間?
let a = 1;
let b = 2;
let c = 'c';
c = 'false';
b++;
a += 3;
let d = a + b;
console.log(d)
```
11.
```
let a = "b"
let b = "a"
let c = "a"
let d = a + b + + c + c ;
console.log(d)
```
12.
```
let a = 1;
a= false;
a= "hello"
let b="world"
let e=a+b;
cosole.log(e);
//console.log值為?
//出現幾個變數、型別、記憶體空間?
```
13.
```
let a = true;
b = false;
a ++;
b --;
console.log(a, b)
```
14.
```
let a = 0;
let b = -1;
let c = a-b;
b = "hi"+a;
a+2;
let d = a+c ;
console.log(d);
```
15.
```
// 1. console.log 值為?
// 2. 出現幾個變數、型別、記憶體空間?
let a = 0;
let b;
b = "JS 棒棒";
let c = true;
let e = c + 3;
a + e;
console.log(a);
```
16.
```
// 1. console.log 值為?
// 2. 出現幾個變數、型別、記憶體空間?
let a=null;
a+=1;
console.log(a);
```
17.
```
// 1. console.log值為?
// 2. 出現幾個變數、類型、記憶體空間?
let c = 5;
let y = "2";
let u = c;
y+=c;
console.log(y);
```
18.
```
// 1. console.log值為?
// 2. 出現幾個變數、類型、記憶體空間?
let a = 2;
let b = a;
a = 3;
a += 2;
console.log(b);
```
19.
```
let x = 1;
x = true;
let y = "2";
let z = x + y;
console.log(z);
```
20.
```
// 1. console.log值為?
// 2. 出現幾個變數、類型、記憶體空間?
let a = "love";
let b = "doubleten";
let c= a+b;
console.log(c);
```
21.
```
// 1. console.log值為?
// 2. 出現幾個變數、類型、記憶體空間?
let s = 2;
s = ‘good’;
let r = 4;
r =’morning’;
let fifth = s+r;
console.log(fifth);
```
22.
```
// 1. console.log值為?
// 2. 出現幾個變數、類型、記憶體空間?
let halfNine, fullNine = ‘9’;
halfNine = ‘9’;
let countNine = halfNine * 9 == fullNine * 9;
console.log(halfNine, fullNine, countNine);
```
23.
```
//1.console.log值為?
// 2. 出現幾個變數、類型、記憶體空間?
let AZ;
AZ = true;
AZ = "牛津第一劑施打:";
let BNT = "輝瑞第一劑施打:";
let injectNumAZ = 7712508;
injectNumAZ--;
let injectNumBNT = 1803768;
injectNumAZ -= 9484;
injectNumBNT += 27007;
console.log(AZ + injectNumAZ, BNT + injectNumBNT);
```
24.
```
//1.console.log值為?
// 2. 出現幾個變數、類型、記憶體空間?
let a=“hello”;
a=true;
let b=100;
let c=b-a;
console.log(c);
```
25.
```
// 1. console.log 值為?
// 2. 出現幾個變數、型別、記憶體空間?
let a = 10;
a += 5;
a = "Hello"
let b;
let c = a + 5;
b = c + "2";
console.log(b);
```
26.
```
// 1. console.log 值為?
// 2. 出現幾個變數、型別、記憶體空間?
let a = 0;
a++;
let b = 'hello';
let c = true;
let d = 'world';
let e = c + d;
console.log(e);
```
27.
```
// 有幾個變數,型別跟記憶體空間?
// console.log的值?
let x = 3;
x = 7;
let y = "hello";
y = 7;
let z = x + y;
console.log(z);
```
28.
```
let a = 21;
a -= 1;
let b = '牛年';
let c = '我鼠年19歲';
let d = true;
let f = '所以今年應該是'
let g = f + a;
console.log(`去年${c},今年${b},${g},${d}`);
// 有幾個變數,型別跟記憶體空間?
// console.log的值?
```
29.
```
let a = 5;
let b = 3;
b = true;
let c = "hello";
a += 2;
console.log(a+b);
```
30.
```
// 1. console.log 值為?
// 2. 出現幾個變數、型別、記憶體空間?
a=8;
let b = 10;
b = a + b;
let c = true;
let d = d + c;
console.log(d);
```
31.
```
// 1. console.log 值為?
// 2. 出現幾個變數、型別、記憶體空間?
let f = 3;
let g = 2;
f--;
g += 5;
console.log(g+f);
```
32.
```
let a = 3 ;
a**=2 ;
let b = 7 ;
b%=2 ;
console.log(a,b);
```
33.
```
// 1. console.log 值為?
// 2. 出現幾個變數、型別、記憶體空間?
let a;
a+=1 ;
a = false;
a = a + "Hello";
lat b = 3;
console.log(b)
```
34.
```
let a = 3;
a--;
a = true;
let b = "Hi";
b = a+b;
console.log(b)
```
35.
```
// 1. console.log 值為?
// 2. 出現幾個變數、型別、記憶體空間?
let a = "abc";
let b = a;
a = 456
b = "abc";
console.log(a+b);
```
36.
```
// 1. console.log 值為?
// 2. 出現幾個變數、型別、記憶體空間?
let a = true;
let b = a + 1;
b += 1;
a = false;
console.log(a+b);
```
37.
```
// 1. console.log 值為?
// 2. 出現幾個變數、型別、記憶體空間?
let a ;
a = 5;
a++;
a = "勞贖";
let b = true;
b = 4;
b = "天竺鼠";
a = b+a;
let c;
console.log(c)
```
38.
```
// 1. console.log 值為?
// 2. 出現幾個變數、型別、記憶體空間?
let f = false;
f = "az";
f = true;
f =1;
f +=2;
let g = "2";
let h = f+g;
console.log(h)
```
39.
```
let strayDog ;
let homeDog = 5;
let isLost = true ;
let lostNum =2 ;
homeDog -= lostNum ;
strayDog += lostNum ;
console.log (strayDog , homeDog);
```
40.
```
// 1. console.log值為?
// 2. 出現幾個變數、類型、記憶體空間?
let quintupleStimulusVoucher = 5000; //振興五倍卷
let dressPrice = 350; //洋裝一件
dressPrice -= 10; //雙十特價折扣10元
quintupleStimulusVoucher -= dressPrice; //用振興卷支付洋裝
let coffeePrice = 50; //咖啡一杯
let burgerPrice = 50; //漢堡一個
quintupleStimulusVoucher = quintupleStimulusVoucher-(coffeePrice + burgerPrice); //用振興卷支付咖啡和漢堡
let amusementParkTicket = 600; //遊樂園票價
amusementParkTicket = 1000; //雙十連假遊樂園推出兩大一小的1000元優惠票價
quintupleStimulusVoucher -= amusementParkTicket; //用振興卷支付遊樂園票價
let oilPrice = 900; //出遊遊玩的油錢
quintupleStimulusVoucher -= oilPrice; //用振興卷支付油錢
console.log(`振興五倍卷剩下${quintupleStimulusVoucher}元`);
// 1. console.log 值為?
// ANS : 振興五倍卷剩下2660元
// 2. 出現幾個變數、型別、記憶體空間?
// ANS : 出現6個變數;只有整數number1個型別;12個記憶體空間
```
41.
```
let num = 10;
num -= 5;
let price = 20;
let discount = 0.8;
let total = price*num*discount
console.log(total)
// 1. console.log 值為?
// 2.出現幾個變數、型別、記憶體空間?
```
42. [Peter](https://hexschool-share.slack.com/archives/C02B2Q8RF6E/p1633867685291600)
```
// 1. console.log 值為?
// 2. 出現幾個變數、型別、記憶體空間?
let q=true;
q = 5;
let i = q+5;
q++;
i = "2";
console.log(q+i);
```