Learn localStorage by Building a Todo App - Step 36

Tell us what’s happening:

this is really hard the statement of the exercise is ultra confusing
please can someone help me?
i have to go in the code down below and exclude somethin?
do i have olny to do things in this line withou change other lines in the code?
please

my line until now

const addOrUpdateTask = (dataArrIndex, taskObj, dataArray) => {
if (dataArrIndex === -1) {
}

Your code so far

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

/* file: styles.css */

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

 const addOrUpdateTask = (dataArrIndex, taskObj, dataArray) => {
     if (dataArrIndex === -1) {
    }

// 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/123.0.0.0 Safari/537.36

Challenge Information:

Learn localStorage by Building a Todo App - Step 36

Already tried to move all from down below with ctrl X + CTRL V
but it doesn work

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)};

Ohman…that was it…we have to go down the code and do a ctrl X and ctrl V in the new const we create… this statements are so confuse but i ger it now
it worked

1 Like

Yeah… this lesson was confusing because all previous courses have taught us that we only need to be focusing on the lines they highlight for us to edit.

For anyone still confused, you have to scroll down to the function with the submit eventlistener and ctrl x + ctrl v the statements they ask for into the new declared const.

2 Likes

The instructions tell you to do this:

Use arrow syntax to create an addOrUpdateTask function. Then move the dataArrIndex variable, the taskObj object, and the if statement into the addOrUpdateTask function.
simply you need to find those three things in your existing code and move it to newly created function.
@LiteralHat

2 Likes

Yes, I’m aware. I think the instructions are worded just fine. I’m mentioning this as more of an UI thing than an instructional one. FCC usually only highlights the lines of code that needs to be edited for each step, so I have a feeling that some users will be confused when they’re asked to touch code outside of the highlighted region.

1 Like