How do you put else condition on this function


I have a function like this:

video.addEventListener("play", function(event) {
     // show image A

I want it to look like this:

if (play) {
	show image A
} else {
	show image B

How would I achieve this?


What would the value of play be, and how would you plan to set its value?

It’s just an example. I want to make an else statement to a function like this one and see if it possible. There should be other ways around but I has yet to discover it.

Sorry, I’m confused at the moment, will ask again later after doing some experiments.

Is there some reason why simply wrapping the if/else inside the function wouldn’t work?