Learn localStorage by Building a Todo App - Step 6

Tell us what’s happening:

I’m stuck on step 6 of the to-do list project (part of your beta-mode Javascript course). This is my syntax:

openTaskFormBtn.addEventListener(“click”, () => { taskForm.classList.toggle(“hidden”); });

When I click the button, it works as expected, but I’m being told the code has not passed. Not sure what’s missing. Help needed!

Your code so far

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

/* file: styles.css */

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

openTaskFormBtn.addEventListener("click", () => {
  taskForm.classList.toggle("hidden");
});

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

Challenge Information:

Learn localStorage by Building a Todo App - Step 6

Your code is working and should be accepted. But the tests need a specific syntax to pass, which is in your callback arrow function.

If you remember, when your arrow function has only one statement or one line of code you can omit the curly braces {} and the semicolon ; and just type that one line after your =>.

Example:

btn.addEventListener("click", () => alert("Hello World!"));
6 Likes

Thanks for the swift reply!

1 Like

genius 2 days staking in this trying many solution even those who isn’t provided by the language and the solution is that simple thank you ya bacha

2 Likes