Answers for "10.2. Using Functions"

0

10.2. Using Functions

/*A function call is the act of using a function by referring to its 
name, followed by parentheses. A synonymous term is function 
invocation, and we will sometimes say that we are "invoking a 
function."

Within parentheses, a comma-separated list of arguments may be 
provided when calling a function. These are sometimes called inputs, 
and we say that the inputs are "passed to" the function.*/

//A generic function call looks like this:
functionName(argument1, argument2,...,argumentN);

/*Every function provides a return value, which can be used by the 
calling program---for example, to store in a variable or print to 
the console.*/

//Example
//A return value may be stored in a variable.

let stringVal = String(42);
/*It may also be used in other ways. For example, here we use the 
return value as the input argument to console.log without storing it.*/

console.log(String(42));

42
Posted by: Guest on June-23-2021
0

10.2. Using Functions

/*If a function doesn't provide an explicit return value, the special 
value undefined will be returned.*/

//Example
let returnVal = console.log("LaunchCode");
console.log(returnVal);

//LaunchCode
//undefined
Posted by: Guest on June-23-2021

Code answers related to "10.2. Using Functions"

Code answers related to "Javascript"

Browse Popular Code Answers by Language