CodePudding user response:
There is no auto return from arrow functions when you use {}
like that. You have to use the return
statement.
if(e.target.className === "deleteNode") {
console.log(e.target.parentNode);
let index = allNodes.findIndex(el => {
console.log("E: " e.target.parentNode.lastChild.innerHTML);
console.log("El: " el.lastChild.innerHTML);
console.log("compare: " el.lastChild.innerHTML.localeCompare(e.target.parentNode.lastChild.innerHTML));
return el.lastChild.innerHTML.localeCompare(e.target.parentNode.lastChild.innerHTML))
});
console.log("index: " index);