1// event = keyup or keydown
2document.addEventListener('keyup', event => {
3 if (event.code === 'Space') {
4 console.log('Space pressed'); //whatever you want to do when space is pressed
5 }
6})
7//don't forget to upvote answers that help you !