Here’s the instructions for this step:
"Add an event listener to the openTaskFormBtn element and pass in a click event for the first argument and an empty callback function for the second argument.
For the callback function, use the classList.toggle() method to toggle the hidden class on the taskForm element.
Now you can click on the “Add new Task” button and see the form modal."
Everything seems to be working fine in the preview, but my code doesn’t pass for some reason.
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
FIXED IT. Instructions a bit unclear - I was supposed to use implicit return.
@jwilkins.oboe , Not sure if it will help the course development or not, but I’m currently on step 9 and am a bit confused with implicit return being used inconsistently with some of the button functions.
as for the closeTaskFormBtn event listeners, in later steps you will add more to those function so that is why implicit returns are not used there.
implicit returns are good when you have short concise one liners.
if you have multiple lines of code, then it is best to wrap that function body inside a set of curly braces.
Thanks so much for the thorough explanation! It makes a lot of sense. I was just frustrated with one of the checks because it was technically ‘correct’, but the code wasn’t passing because I was supposed to use implicit return