I have an event when user clicks on keyDown on keyboard and it works but I want when the click happens for the second time to do something different. It works also, but if user click on keyboard twice quickly it will make my animation not look good. I want the second event not occur until first is finished. What should I do?
I need something make the same event uncallable until the first is done.
window.addEventListener("keydown", (e) => {
(e.key === "ArrowDown") ? slideDown() : null;
(e.key === "ArrowUp") ? slideUp() : null;
(counter === 3) ? myName.style.color = "white" : myName.style.color = "black";
})