function removeTransition(e){ console.log(e.propertyName) // can do a condition based on a property or add a property using setProperty //example this.style.setProperty("background-color", 'blue'); // a a consition to if(e.propertyName !== 'transform') return this.classList.remove('playing'); } const keys = [...document.querySelectorAll('.key')]; //loop over all items clicked keys.forEach((key) => key.addEventListener('transitionend', removeTransition))