samedi 18 avril 2020

Explain this If condition

It's one piece of function Todo Web Application project . The problem is i can't figure out how this if condition work. anybody can explain this item.classList[0] === "trash-button" condition workflow

function deleteCheck(e) {
  const item = e.target;
  //Delete Todo
  if (item.classList[0] === "trash-button") {
    const todo = item.parentElement;
    //Animation
    todo.classList.add("fall");
    todo.addEventListener('transitionend', function() {
      todo.remove();
    })

  }

Aucun commentaire:

Enregistrer un commentaire