0

So, I'm very new to Javascript and I've been following this javascript30.com course and it's the first day.

I'm trying to wrap my head around that removeTransition function call. How is that valid and what exactly is getting passed as 'e'?

function removeTransition(e) {
        if (e.propertyName !== "transform") return;
        e.target.classList.remove("playing");
      }

. .

const keys = Array.from(document.querySelectorAll(".key"));
      keys.forEach((key) =>
        key.addEventListener("transitionend", removeTransition)
      );
9
  • do you know python by any chance ? or any language which can use function as arguments (or in general values) . it will help people who are writing the answers Commented May 22, 2020 at 4:06
  • As far as I can understand , removeTransition is being called from the HTML , where e denotes an event object Commented May 22, 2020 at 4:07
  • you are registering removeTransition function with the event listener for an event, transistionend. The browser event manager will invoke this function with an event (which the formal parameter, e of this function) Commented May 22, 2020 at 4:12
  • @ashishsingh I've only really programmed in Java Commented May 22, 2020 at 4:19
  • 1
    ok i will write an answer you can follow up in comments Commented May 22, 2020 at 4:19

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.