Do we have to give arguments for functions with parameters? Can we give a function more arguments that it has parameters?


#1

Question

Do we have to give arguments for functions with parameters? Can we give a function more arguments that it has parameters?

Answer

It is strongly encouraged to give all functions with parameters enough arguments to satisfy all the parameters. If you do not do this, the parameters later in the parameter list that were not supplied arguments will be given the value undefined. You can give the function more arguments than there are parameters but the extra arguments will not be used once the parameters are satisfied.