You also want a deleted task to be removed from local storage. For this, you don’t need the removeItem() or clear() methods. Since you already use splice() to remove the deleted task from taskData, all you need to do now is save taskData to local storage again.
Use setItem() to save the taskData array again. Pass in data as the key and ensure that taskData is stringified before saving.
/* file: script.js */
// User Editable Region
localStorage.setItem('data', JSON.stringify(taskData));
taskData.splice(dataArrIndex, 1);
// User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36
Challenge Information:
Learn localStorage by Building a Todo App - Step 57
But you shouldn’t have taskData.splice(dataArrIndex, 1); after the localStorage code.
If you moved that line of code from it initial location, the test will fail. But if you just duplicated the code it should still pass (but you still shouldn’t have it).