Learn localStorage by Building a Todo App - Step 31

Tell us what’s happening:

I cannot—for the life of me— get this one to work. All I have to do is create an arrow function and simply select and move existing code (that already passed previous exercises) into it. “Use arrow syntax to create an updateTaskContainer function. Then move the taskData.forEach() and its content into it.”

Your code so far

const updateTaskContainer=()=>{
      ({ id, title, date, description }) =>
        (tasksContainer.innerHTML += `
        <div class="task" id="${id}">
          <p><strong>Title:</strong> ${title}</p>
          <p><strong>Date:</strong> ${date}</p>
          <p><strong>Description:</strong> ${description}</p>
          <button type="button" class="btn">Edit</button>
          <button type="button" class="btn">Delete</button>

Yet I keep getting the following
###Error Message
" You should move taskData.forEach() and its content into the updateTaskContainer() function."

Any ideas? I don’t wanna get all pretentious and be like “Oh it’s probably just a bug, no way MY code is wrong,” but I honestly don’t see what’s wrong with it. Ran it through ChatGPT and it didn’t find any issues either.

SOLUTION: So I got it to work by simply adding spaces to the arrow function:
this updateTaskContainer=()=> doesn’t work

but this updateTaskContainer = () => does.

Am I crazy or there’s no reason why the first case shouldn’t work?

1 Like

I think it should work but first, can you please provide a link to the exercise you are referring to?

1 Like

There is a regex that does not allow for the missing space between the identifier and the assignment operator.


And yes, it should pass without the space.

Edit: I wouldn’t suggest you write your code like that unless you use a code formatter.


1 Like