diff --git a/index.js b/index.js index 0f350ce..9bb9a1c 100644 --- a/index.js +++ b/index.js @@ -1,12 +1,12 @@ -window.addEventListener('DOMContentLoaded',() => { - const input=document.querySelector('input') - input.addEventListener('keydown',(event) => { - if(event.code==='Enter'){ - alert(event.code) - } +// @ts-check +window.addEventListener('DOMContentLoaded', () => { + const input = document.querySelector('input') + input.addEventListener('keydown', (event) => { + const message = `${event.code} ${event.key}` + alert(message) }) }) -// @ts-check window.addEventListener('keydown', (event) => { - alert(event.code) + const message = `${event.code} ${event.key}` + alert(message) }) \ No newline at end of file