We can set default parameters for arguments as shown in this example.
Here we have a function called my age.
We have a single argument assigned to this function called mean age with a default parameter set to
equal 30.
Now when we call this function if we do not assign a specific value to our men age argument the output
will be the default perimeter value.
Third we can see in the remaining calls of value has been assigned for this reason the assigned value
will be output.
In our web browser and we can see the end result here.
The first call to our function.
My age outputs the default value thirty in all the other calls the assigned value is output it
in this next example.
We've used the return statement to calculate the sum of two arguments x and y.
We can see the arithmetic operation z is equal to x plus y then a request to output the result using
the return method
we can see here that we've assigned values to x and y in our calls to the function named +.
The first assignment is 1 for the x value in 2 for the y value.
The output is 3
and for the second it's 3 and 4.
So we have an output of 7 and the last is 5 plus 5 which is 10.