Yes, because it keeps the unique part about it all in the one place, tied to the .buttone name, instead of being scattered all over the place as linke and covere and activee and playe and so on and on and on.
var button is defined at the top of the code, so that variable is available. Does it contain anything useful? When initButton us run it does so that’s all good. The button variable is available from everywhere inside of that IIFE function.
The hideAllButtons() function no longer has any parameters and uses button, which will reference that var button variable which is good.
Yes, the button can be removed from that hideAllButtons line you were speaking about.
When deciding whether to use var button or var playButton I looked through the code and saw that button was more frequently used. Being lazy (or efficient), I chose the name that was more frequently used. Both work just as well as the other.
Having said that though, because we are in code that’s all about dealing with the play button, there’s no need to repeat ourselves by calling it playButton all over the place.
It could be called clickHandlerButton, or InitialOverlayButton, or iconParents, or imageContainer, or anything else like that.
Usually though, there’s a word or phrase that does an 80% good job of explaining things. That 80/20 rule you will come across a lot. The first 80% is much easier to achieve than the remaining 20%. People use 80% and rarely use the other 20%. It’s all over. The word button while not perfect, is good enough in the context of how it’s being used in the code to explain and represent what is happening there.