Tell us what’s happening:
Same again maybe it’s a misunderstanding issue how do I correct this task?
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
const deleteTask = (buttonEl) => {
const dataArrIndex = taskData.findIndex(
(item) => item.id === buttonEl.parentElement.id
);
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/605.1.15 (KHTML, like Gecko) Version/18.1.1 Safari/605.1.15
Challenge Information:
Learn localStorage by Building a Todo App - Step 44
You need one more line in the function, code.code.remove()
What’s this last line thanks?
Right now you solved half of the solution, so follow this exactly and put on top taskData.splice
Use the remove()
method to remove the parentElement
of the buttonEl
from the DOM. In other words you need two lines of code.
How’s this?
remove(parentElement, buttonEl);
No in this case just call the method remove() and chain it to the args.
Please provide the correct solution.
ILM
January 15, 2025, 6:27pm
8
you should be aware by now that this forum doesn’t allow sharing solutions, you should not even ask.
What are you stuck with? what questions and doubts do you have? what do you not understand?
I’m stuck on the removal stage I need an example of correcting this.
Sorry, your code does not pass. Try again.
You should use the remove()
method to remove the parent element of buttonEl
.
ILM
January 15, 2025, 6:32pm
10
what is your code? what have you tried?
remove()
method aren’t used like that. It’s didn’t want the required values within it’s braces.
The required elements should chain to it using a dot. Like:
el.pareEl.remove()
const deleteTask = (buttonEl) => {
const dataArrIndex = taskData.findIndex(
(item) => item.id === buttonEl.parentElement.id
);
taskData.splice(dataArrIndex, 1);
remove("parentElement" (buttonEl)
};
ILM
January 15, 2025, 8:51pm
13
remove
is a method of HTMLNode, do you remember the difference between methods and functions?