Learn localStorage by Building a Todo App - Step 30

Tell us what’s happening:

Im given the message

Sorry, your code does not pass. You’re getting there.

You should move the if statement with the condition dataArrIndex === -1 into your addOrUpdateTask function.

but I do have the if statement within the addOrUpdateTask function

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) {
    } 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/ Safari/537.36

Challenge Information:

Learn localStorage by Building a Todo App - Step 30

where did this else statement come from?

looking at the original code, that wasn’t there

once you fix that, then you should be good