Learn localStorage by Building a Todo App - Step 35

Tell us what’s happening:

why doesn’t it work if the value is equated to true?

Your code so far

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

/* file: styles.css */

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

  if(formInputsContainValues === true){
    confirmCloseDialog.showModal();
  }
  else{
    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 35

Hi @booleanmethod9

To check the truthiness of a value, you do no compare it to true
Just add the value between the round braces by itself.

Happy coding

1 Like

As Teller points out, there are things that evaluate to true and you don’t have to do === true.
You can test if something is “truthy” as it is called like this: console.log(Boolean(testValuePutHere)); and it will print to console if testValuePutHere is truthy or falsy. I hope this helps your understanding.

You can read more about truthy and falsy here: Truthy - MDN Web Docs Glossary: Definitions of Web-related terms | MDN

1 Like

Thank you for the help

2 Likes