diff --git a/2-ui/3-event-details/7-keyboard-events/2-check-sync-keydown/solution.md b/2-ui/3-event-details/7-keyboard-events/2-check-sync-keydown/solution.md index 453f8c9466..7ad2098cf8 100644 --- a/2-ui/3-event-details/7-keyboard-events/2-check-sync-keydown/solution.md +++ b/2-ui/3-event-details/7-keyboard-events/2-check-sync-keydown/solution.md @@ -1,6 +1,6 @@ -We should use two handlers: `document.onkeydown` and `document.onkeyup`. +우리는 `document.onkeydown` 과 `document.onkeyup`의 두 가지 핸들러를 사용해야 합니다. -Let's create a set `pressed = new Set()` to keep currently pressed keys. +현재 누른 키를 유지할 수 있도록 `pressed = new Set()` 세트를 만듭니다. -The first handler adds to it, while the second one removes from it. Every time on `keydown` we check if we have enough keys pressed, and run the function if it is so. +첫 번째 핸들러가 추가되고 두 번째 핸들러는 제거됩니다. `keydown`을 할 때마다 충분한 키를 눌렀는지 확인하고, 그 경우에 함수를 실행합니다. diff --git a/2-ui/3-event-details/7-keyboard-events/2-check-sync-keydown/task.md b/2-ui/3-event-details/7-keyboard-events/2-check-sync-keydown/task.md index 51c2fa2bdc..1f3a705adc 100644 --- a/2-ui/3-event-details/7-keyboard-events/2-check-sync-keydown/task.md +++ b/2-ui/3-event-details/7-keyboard-events/2-check-sync-keydown/task.md @@ -2,11 +2,11 @@ importance: 5 --- -# Extended hotkeys +# 확장 단축키 -Create a function `runOnKeys(func, code1, code2, ... code_n)` that runs `func` on simultaneous pressing of keys with codes `code1`, `code2`, ..., `code_n`. +함수 `runOnKeys(func, code1, code2, ... code_n)`를 만듭니다. 함수 runOnKeys는 `code1`, `code2`, ..., `code_n`이 있는 키를 동시에 누를 때 `func`를 실행하는 함수입니다. -For instance, the code below shows `alert` when `"Q"` and `"W"` are pressed together (in any language, with or without CapsLock) +예를 들어 아래 코드는 `"Q"` 와 `"W"` 를 함께 누르면 `alert` 창이 표시됩니다(CapsLock 사용 여부에 관계없이 모든 언어에서 표시됨). ```js no-beautify runOnKeys(