---
# System prepended metadata

title: 第二週小組任務 - JS班 14 組
tags: [JS 直播班 - 2022 秋季班]

---

---
tags: JS 直播班 - 2022 秋季班
---
# 第二週小組任務 - JS班 14 組
> 討論日期及時間 > 2022/10/09 20:30-21:30
> 
**組員參與名單(07/09)：**
* christina#6185
* hungya#0773
* DoraHuang#8223
<!-- * Winnie Wu#5468 -->
* Potatolee#7749
* Nathan James#8120
* Sonia Wu#7154
<!-- * Tuhacrt#0008 -->
* CrystalD#6007

## 問題集的答案
### 第ㄧ題 繪製與討論剪刀石頭布的邏輯
答：


| Name | whimsical link |
| -------- | -------- |
| Sonia Wu#7154 | [link](https://whimsical.com/Wf1a9FjosGkrLaEMFnZeJZ) |
| Potatolee#7749 | [link](https://whimsical.com/AUyvXk8EaHNAaAkf5LYSP8) |
| hungya#0773 | [link](https://whimsical.com/js-8iNTydHztXhVdgFNQ2KXhr) |
| christina#6185 | [link](https://whimsical.com/HapprFjvVufCr7KgK62QLG) |
| CrystalD#6007 | [link](https://whimsical.com/HZEzgMp2rFX5S4h9FHiRBW) |


![](https://i.imgur.com/W4sbm2z.png)

![](https://i.imgur.com/X5IttyH.png)

![](https://i.imgur.com/5EiYr6V.png)

#### 討論到的寫法
![](https://i.imgur.com/SMrZwBK.png)

![](https://i.imgur.com/N94t5Pd.png)

![](https://i.imgur.com/KnLC2M2.png)

![](https://i.imgur.com/1IGvPy7.png)


![](https://i.imgur.com/M54innO.png)


```
let A = '剪刀';
let B = '剪刀';
if (A==B){
  console.log('平手');
}else if((A=='剪刀' && B=='布') || (A=='石頭' && B=='剪刀') || (A=='布' && B=='石頭')){
  console.log('A贏');
}else{
  console.log('B贏');
}

```
![](https://i.imgur.com/C5yHThk.png)

```
let playerA = "剪刀";
let playerB = "石頭";
let winner ; 

if(playerA === playerB){
   winner ="平手";
}else if(playerA === "剪刀"){
   winner = (playerB ==="石頭")?  "PlayerB Win" :  "PlayerA Win";
}else if(playerA === "石頭"){
    winner = (playerB ==="布")?  "PlayerB Win" :  "PlayerA Win";
}else{
    winner = (playerB ==="剪刀")?  "PlayerB Win" :  "PlayerA Win";
}

console.log(winner);
```

![](https://i.imgur.com/q7gIKQ6.png)

```
let playerA = "rock";
let playerB = "scissors";

let result = {

    //贏的組合1:剪刀贏布
    scissors : "paper",
    //贏的組合2:布贏石頭
    paper : "rock",
    //贏的組合3:石頭贏剪刀
    rock : "scissors"
};

//如果playerA有在贏的組合內
if(playerA === playerB){
    console.log("平手");
}else if(result[playerA]===playerB){
    console.log("playerA win");
}else{
    console.log("playerB win");
}
```

<!-- ## 討論紀錄 -->

---

> 謝謝今天有參與的同學們 :100: 
<iframe src="https://giphy.com/embed/3o72EX5QZ9N9d51dqo" width="480" height="250" frameBorder="0" class="giphy-embed" allowFullScreen></iframe><p><a href="https://giphy.com/gifs/producthunt-cats-music-streaming-3o72EX5QZ9N9d51dqo"></a></p>