|
var myFunction = function (Parameter)
Is the parameter a variable?
|
|
The parameter is the variable you input into the function.
|
Yes. So, for example:
PHP Code:
var multiplyByTwo = function (number) { // Define first passed variable (parameter) as 'number'.
return number * 2; // Use the function to return a number result of input number times two.
};
console.log(multiplyByTwo(5)); // Pass two as a variable
would log 10 into the console.