Learn localStorage by Building a Todo App - Step 7

Tell us what’s happening:

What is wrong with this answer. Other answers in the forum put a “function” keyword behind the function but this seems to be how a function is called, why doesn’t it work, do you know…

Your code so far

<!-- file: index.html -->

/* file: styles.css */

/* file: script.js */
// User Editable Region

closeTaskFormBtn("click", (confirmCloseDialog.showModal()) => {});

// 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/131.0.0.0 Safari/537.36

Challenge Information:

Learn localStorage by Building a Todo App - Step 7

Here is the correct syntax for adding an event listener.

element.addEventListener("event", function)

Now adjust your event listener per the syntax example.
You need to call your function in the arrow function body, in your case, you used it as an argument to the function.

But they dont say whether to use the arrow function body or the argument to the function…

my bad, it’s a callback function, let me re-evaluate my guidance.

It actually worked, Im just wondering about the why

An arrow function can sometimes serve as a callback function, however I did not use this logic when working out your problem. After an event in an event listener, a function follows, an arrow function is the standard way of writing functions and that’s what I used.