The remove function is meant to remove a specific element from the todoList, but it removes everything when it is called,
Hello every one,
I am trying to write a program that add, remove, reset todolist using the terminal.
The problem is that the remove function works like reset and delete everything at once instead of removing the element in the specified position.
Can you please help me to fix it?!
Thanks in advance!

Can you please update your topic title with a short description which conveys the help you seek?

Thank you.

Hello, I’m not good in english, but I try to answer you.
Look, first problem - arrays method “filter”. It handle’s every element and push it to new array if you return true on this iteration. Now you return only false and your final array is empty. You compare maybe “strings” and your index number.
Second - filter has parameter “index”, you need to compare it with your “index”, but be careful with the same names.
Third - you need to do type conversion with your “index”, to be sure that you compare with number, not string “2”

1 Like

Using the name index twice was the biggest problem to me.
I have solved it, thanks for your response.