Tell us what’s happening:
I have tried everything I can possibly think of to get the solution, but I can’t seem to get it right. This was just the first solution I tried. I’m sure it’s probably something simple that I’m missing.
No matter what I do it keeps telling me " You need to add an addEventListener
to the global window
object."
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
window.addEventListener('keydown', event => {
const { key } = event;
// User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36
Challenge Information:
Learn Intermediate OOP by Building a Platformer Game - Step 59