15👍
✅
I think this will works
deleteNote(i) {
this.lists = this.lists.filter((_, index) => index !== i);
}
1👍
You need to use second argument to the filter function.
let arr = this.lists.filter( (item, index) =>
item.note !== this.lists[index]
);
this.lists = arr;
Here is MDN docs for Filter
Hope this helps!
1👍
By the looks of it, you want to remove an item by index?
deleteNote(i) {
this.lists.splice(i, 1);
}
The above snippet should modify the existing array and remove one element at the desired index.
Source:stackexchange.com