Links.splice(Links.indexOf(linkIndex),1);
it is not finding the indexOf the element i clicked on in local storage and it is deleting local storage from the back what am i doing wrong please
ulEl.addEventListener("click",function(e) {
const item = e.target;
if(item.classList.contains("bin-img")){
const link = item.parentElement.parentElement.parentElement;
link.remove()
function removeLocalLink(link) {
let Links;
if (localStorage.getItem("Links") === null) {
Links = [];
} else {
Links = JSON.parse(localStorage.getItem("Links"));
}
const linkIndex = link.children[2].textContent;
console.dir(linkIndex)
Links.splice(Links.indexOf(linkIndex),1);
console.dir( Links.splice(Links.indexOf(linkIndex),1))
localStorage.setItem("Links", JSON.stringify(Links));
}
removeLocalLink(link)
}
}