"window" is JS element which is all your browser page. "addEventListener" listens all events "keydown" (press key on keyboard) on this element (when mouse cursor is in the page). Then it runs function. In function we check code of this key (event.code) and if it`s true we do code in {}.
For example key Z has code "KeyZ", shift has code "ShiftRight" and "ShiftLeft". You should replace string "yourKeyCode" with needed you key code.
If you need check press key on concret element (some input, for example), you can use
yourElement.addEventListener("keydown", function...
"yourElement" you can get with
var yourElement = document.querySelector(".class-name")
"class -name" is name of your element class, or you can use # for get element by id (querySelector("#yourId");)