Need help with step 30 of TODO project

it was not me that asked the initial question but i am stuck on the same step: i am trying to use arrow syntax to create an addOrUpdate function, then move the dataArrIndex variable and the taskObj and if statement inside the addOrUpdateTask. help me get past this stage please

const addOrUpdateTask = () => {dataArrIndex, taskObj};

I created a new topic for you.

Remove what you have inside this arrow function here.

This should be your starting point

const addOrUpdateTask = () => {


the directions say to move the move the dataArrIndex variable, the taskObj object, and the if statement into the addOrUpdateTask function.

Look down further into the page and you should see this event listener taskForm.addEventListener("submit", (e) =>

Inside that callback for the event listener, you should see the dataArrIndex variable, the taskObj object, and the if statement.

Copy and paste that code, inside your addOrUpdateTask function to pass the tests

1 Like

Just to clarify, you don’t want to copy and paste that code. You want to copy and cut that code from the lower section, and paste it into the function you just created, addOrUpdateTask.

The purpose of building this function, addOrUpdateTask is replacing the previously written code so it being both places makes it susceptible to errors and other erratic behaviors.


1 Like