A function is a group of code that can be executed by calling its name or by the variable name which you have stored a function that has been defined using an expression.
function name(parameters) // block of code
And you call the function:
You can pass parameters to a function by adding the variables inside the parentheses
If you want to have a function with variable number of parameters, then you don’t have to do anything. When a new function is declared, a new array called arguments is created.
This is how you define a function using an expression:
The above function is an anonymous function. Those functions are called first-class objects and can be manipulated like all the other objects.