Learn Intermediate OOP by Building a Platformer Game - Step 59

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

Hi @keshelton0821

For the arguments, pass in the keydown event and an arrow function that uses the destructuring assignment to get the key property from the event object in the event listener parameter.

You are asked to add parameters to the addEventLister method.

This needs to be a part of the parameter.

Happy coding

Figured it out! I was literally just reading it wrong.

1 Like