Functions: Can't Skip Over Arguments

by Chetak Patel

HTML

<b><p>You can't skip over an argument.</p>Open your console to see the output from this code!</b>
<p>Here we have a function that takes three arugments, and assigns them to three parameters.    </p>
<p>While you don't have to pass in three arguments (you might have only one or two), the only way to get a value into the third parameter is to pass three arguments, even if some are undefined.  </p>

JavaScript

/* When you do use parameters, you can't skip.
 */ 

int [] numbers = { 1, 2, 3, 4, 5 ,6, 7, 8, 9 , 10 };
int sum = 0;
for(int i = 0; i < numbers.length; i++){
    sum += numbers[i];
}
console.log("The sum is: " + sum);