Learn localStorage by Building a Todo App - Step 35

Tell us what’s happening:

i have done the following required but it still tells me that my if statement isnt present

Your code so far

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

/* file: styles.css */

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

const addOrUpdateTask = () => {
  const dataArrIndex = taskData.findIndex(item => item.id === currentTask.id);

  const taskObj = {
    id: `${titleInput.value.toLowerCase().split(' ').join('-')}-${Date.now()}`,
    title: titleInput.value,
    date: dateInput.value,
    description: descriptionInput.value,
  };

  if (dataArrIndex === -1) {
    taskData.unshift(taskObj);
  } else {
    taskData[dataArrIndex] = taskObj;
  }
};


// 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/134.0.0.0 Safari/537.36 OPR/119.0.0.0

Challenge Information:

Learn localStorage by Building a Todo App - Step 35

Hi. You added a bit more than expected. According to the exercise, you have to create an arrow function which contains a variable, an object and an if clause (only if!).