Untitled

mail@pastecode.io avatar
unknown
javascript
2 years ago
420 B
1
Indexable
Never
let btnDelete = document.querySelectorAll(".deleteItem");

// AVANT 
for (let i = 0; i < btnDelete.length; i++) {
  btnDelete[i].addEventListener('click', deleteContentCart);
}

// APRES
btnDelete.forEach(buttonItem => {
  buttonItem.addEventListener('click', deleteContentCart);
});

// APRES, SANS FONCTiON FLECHEE
btnDelete.forEach(function(buttonItem) {
  buttonItem.addEventListener('click', deleteContentCart);
});