Skip to content

Commit f055757

Browse files
committed
* keycode is not key
1 parent 208a8be commit f055757

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

spreadsheet/chapter.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ If it is, we use `$timeout` to schedule an update to the focused cell after the
238238
const direction = (which === 38) ? -1 : +1;
239239
```
240240
241-
The `const` declarator means `direction` will not change during the functions execution. The direction to move is either upward (`-1`, from **A2** to **A1**) if the key code is **UP** (38), or downward (`+1`, from **A2** to **A3**) otherwise.
241+
The `const` declarator means `direction` will not change during the functions execution. The direction to move is either upward (`-1`, from **A2** to **A1**) if the key code is 38 (**UP**), or downward (`+1`, from **A2** to **A3**) otherwise.
242242

243243
Next up, we retrieve the target element using the ID selector syntax (e.g. `"#A3"`), constructed with a [template string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/template_strings) written in a pair of back-quotes, concatenating the leading `#`, the current `col` and the target `row + direction`:
244244

spreadsheet/chapter.zh-tw.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ function Spreadsheet ($scope, $timeout) {
237237
const direction = (which === 38) ? -1 : +1;
238238
```
239239

240-
此處的 `const` 宣告,指的是 `direction` 的值在函式執行期間不會改變。如果按鍵碼是 **上鍵** (38),表示往上移動(`-1`, 從 **A2****A1**),否則往下移動(`+1`,從 **A2****A3**)。
240+
此處的 `const` 宣告,指的是 `direction` 的值在函式執行期間不會改變。如果按鍵碼是 38**上鍵**,表示往上移動(`-1`, 從 **A2****A1**),否則往下移動(`+1`,從 **A2****A3**)。
241241

242242
接下來,我們使用以反引號撰寫的[模板字串](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/template_strings)將開頭的 `#`、當前的直欄 `col` 和目標橫列 `row + direction` 串聯在一起,構築出 ID 選擇器(例如`"#A3"`),來取得目標元素:
243243

0 commit comments

Comments
 (0)