I am having a question that I find it difficult to understand.
The question is about JavaScript functions and it’s parameters.
When we write a function we can give it from one to various parameters, for example
function myCustomFunction(parameterOne, parameterTwo)
Then we can use these parameters as arguments when we are calling the function, for example
myFunction("hello", "World")
and it will give us the values "hello" and "World" when we call the function.
However there is one thing that I see a lot of people making that I don’t really understand and that is, some people when they write a function they are passing a parameter (el) or (e) which I know they stand for element or event. They are using the parameter in the function without calling the function for example
el.className = "something"
e.className = "somethingElse";
What is the purpose of that parameter when we create a function and what can I really do with it?
P.S Please explain as detailed as possible.
Thanks.