Arguments

The code inside a function often needs information passed to it.
You can define this information by adding parameters to the declaration allowing you to pass in arguments.
When a variable is passed to a subroutine or function it is called an argument.
The value used in place of the parameter when we make the procedure call is called an argument.


too many - ignored
too few - undefined


function add() { 
   var tempValue = 0;
   for (I = 0; I < arguments.length; i++)
   {
      tempValue += arguments[i];
   }
   return tempValue;
}
var myTotal = add(1,2,3,4,5,6);



© 2019 Better Solutions Limited. All Rights Reserved. © 2019 Better Solutions Limited TopPrevNext