mirror of https://github.com/01-edu/public.git
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.
21 lines
881 B
21 lines
881 B
4 years ago
|
## Keycodes symphony
|
||
|
|
||
|
### Instructions
|
||
|
|
||
|
Like an inspired Beethoven who's going to write his Moonlight Sonata, you're about to compose a colourful symphony of letters with your keyboard.
|
||
|
|
||
|
Export the function `compose`:
|
||
|
|
||
|
- Make it fire every time a key is pressed
|
||
|
- Create a new `note`, which has a background color generated using its `keyCode`, and displays the corresponding letter pressed
|
||
|
- If the pressed key is the `Delete` one, delete the last note
|
||
|
- If the pressed key is the `Escape` one, clear all the notes
|
||
|
|
||
|
### Notions
|
||
|
|
||
|
- [Keyboard event](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent): [`keydown`](https://developer.mozilla.org/en-US/docs/Web/API/Document/keydown_event), [`key`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key)
|
||
|
|
||
|
### Expected result
|
||
|
|
||
|
You can see an example of the expected result [here](https://youtu.be/5DdijwBnpAk)
|