Learn localStorage by Building a Todo App - Step 37

Hello,

I’m trying to complete this step of project but I’m unable to get past it due to some error I’m not catching.

The task is to “Use arrow syntax to create an updateTaskContainer function. Then move the taskData.forEach() and its content into it.” and the error I’m getting when submitting the code is “You should move taskData.forEach() and its content into the updateTaskContainer() function.” which I did with previous passing code but no luck:

const updateTaskContainer = () => {
    taskData.forEach(({ 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>
            </div>
        `;
    });
};

I’ve tried deleting the ( ; ) at the end of every line, leaving everything in one line, not using the {} of the callback functions but no luck, no luck at all.

I don’t think this is due to some error in the code since this is already passing code of a previous step.

Help please, thanks :slight_smile:

1 Like

Hello,
Your code is not wrong,
the error here is just because of code formattingwrong
To fix it wrap the tasksContainer.innerHTML assignment in ( ) and remove the ;
As for the }); down at the bottom make it look like this and beware of the required white space or else it might not work

  }
 );

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.