'my deleted items is deleting from my to do list page ui but it deleting the wrong item in my local storage

 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)
    }
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source