Learn Intermediate OOP by Building a Platformer Game - Step 55

Tell us what’s happening:

The challenge reads:

Start by adding an addEventListener to the global window object. 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.

I don’t see how I’m not doing this. Any help is appreciated. Thank you!

Your code so far

window.addEventListener("keydown", (event) => {
  const {key} = event;
});

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36

Challenge Information:

Learn Intermediate OOP by Building a Platformer Game - Step 55

1 Like

It looks like you did it correctly.

Unfortunately, the test is looking for a specific solution.

I have created an issue to update the tests.
I posted the answer the test is looking for in that issue too

6 Likes

Thank you! I was driving myself insane trying to figure out how I was wrong.

1 Like

Thank you… I tried the same solution as PowerfulGhost and this:
window.addEventListener(“keydown”, ({key}) => key);
but neither passed.