Parameter (JavaScript)
noun
say it: “JAH-vuh-skript” /ˈdʒɑːvəskrɪpt/ or “puh-RAM-ih-ter” /pəˈræmɪtər/
A name in a function's parentheses that receives a value when the function is called.
What is a parameter?
A parameter (also known as an input parameter) is a way of receiving a variable into a function.
Parameters are defined when creating a function. The declared paramaters are variables that are in scope throughout the function (they are only available to access inside the function body.)
// the variables *first* and *second* are input parameters
function add(first, second) {
return first + second;
}
In a sentence
- “The arrow function (order) => order.total has one parameter, order.”
- “In function addTax(price), price is a parameter.”
Level: Apprentice · More JavaScript terms at this level
Updated