You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
# 運算子
|
|
|
|
|
|
|
|
|
|
## 簡介
|
|
|
|
|
|
|
|
|
|
把玩並熟悉運算子。以下是建議的練習程式模板:
|
|
|
|
|
|
|
|
|
|
你有兩套提供給同一組學生的成績系統。
|
|
|
|
|
|
|
|
|
|
### 第一套成績系統
|
|
|
|
|
|
|
|
|
|
定義分數為 1 到 5。當分數 3 以上時通過測驗。
|
|
|
|
|
|
|
|
|
|
### 第二套成績系統
|
|
|
|
|
|
|
|
|
|
定義分數為 `A, A-, B, B-, C, C-`, `A` 為最高分而 `C` 為最低分,皆為通過測驗。
|
|
|
|
|
|
|
|
|
|
### 課題
|
|
|
|
|
|
|
|
|
|
使用下列矩陣 `allStudents` 表示所有學生的成績,試著建立新的矩陣 `studentsWhoPass` 包含所有通過學生的編號。
|
|
|
|
|
|
|
|
|
|
> 提示,使用 for-loop 迴圈、 if...else 條件式與比較運算子:
|
|
|
|
|
|
|
|
|
|
```javascript
|
|
|
|
|
let allStudents = [
|
|
|
|
|
'A',
|
|
|
|
|
'B-',
|
|
|
|
|
1,
|
|
|
|
|
4,
|
|
|
|
|
5,
|
|
|
|
|
2
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
let studentsWhoPass = [];
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## 學習評量
|
|
|
|
|
|
|
|
|
|
| 作業內容 | 優良 | 普通 | 待改進 |
|
|
|
|
|
| -------- | ---------------------- | ------------------------ | ---------- |
|
|
|
|
|
| | 提供完整的解答與解釋。 | 只提供部分的解答與解釋。 | 解答有誤。 |
|
|
|
|
|
|