fix(curriculum): add example for arrow functions in Platformer Game (#54982)

Co-authored-by: Naomi <accounts+github@nhcarrigan.com>
Co-authored-by: Lasse Jørgensen <28780271+lasjorg@users.noreply.github.com>
This commit is contained in:
Ali Muhsin
2024-05-29 22:24:15 +02:00
committed by GitHub
co-authored by Naomi Lasse Jørgensen
parent b234cf8097
commit 680b319cea
@@ -13,6 +13,14 @@ 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 in the event listener parameter.
Here is the syntax for using the destructuring assignment in the parameter list of the arrow function:
```js
btn.addEventListener('click', ({ target }) => {
console.log(target);
});
```
# --hints--
You need to add an `addEventListener` to the global `window` object.