Learn localStorage by Building a Todo App - Step 32

Tell us what’s happening:

Whats wrong with this code, Ive done ecerything that seems to be required, and also this seems to be what the answer requested in the forum…

Your code so far

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

/* file: styles.css */

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

  taskForm.classList.toggle(reset);

// 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 32

Hi @booleanmethod9

You should call the reset function.

Function calls require round braces.

Happy coding

Hi @booleanmethod9 , let’s break this down.

Remove the existing code toggling the class of hidden on taskForm
taskForm.classList.toggle("hidden");

This code is toggling (applying or removing) the “hidden” class on the taskForm element.

What you’ve done is you’ve replaced the classname “hidden” with a class named “reset”. If what that code does is toggle a class called “hidden”, then replacing that with any other word is going to toggle a class of that word.

… and call the reset function instead.

What they are asking of you is to call a function called reset ( not toggle a class called reset ).

At this point it is absolutely necessary that you understand these 2 concepts:

  • Calling an element’s method (function)
  • Toggling a class on an element with the .toggle() function

Hint: Since ‘toggle’ is the function you are currently calling on your form element, it is not the string you pass to toggle but the toggle function itself that need to be replaced.

Use the Mozilla MDN web docs in the future to read up on each new thing you encounter. This is just good practice:

calling functions - Functions - JavaScript | MDN

reset function - HTMLFormElement: reset() method - Web APIs | MDN

toggle function - DOMTokenList: toggle() method - Web APIs | MDN

Good luck!

Remove the whole code and just call only the reset function