1document.addEventListener("keydown", function(event) {
2 if (event.keyCode == 32) {
3 console.log("Space was pressed!");
4 }
5});
1eventTarget.addEventListener("keydown", event => {
2 if (event.isComposing || event.keyCode === 229) {
3 return;
4 }
5 // do something
6});