Parameters and Arguments (JavaScript)
A parameter is defined by the function to specify what input is required to call the…
What is the difference between a parameter and an argument?
A parameter is defined by the function to specify what input is required to call the function.
function add(first, second) {
return first + second;
}
An argument is a value that is passed into a function when calling the function
let costOfChocolate = 3.49;
let costOfMilk = 3.99;
// *costOfChocolate* and *costOfMilk* are arguments on line 4
let sum = add(costOfChocolate, costOfMilk);
Level: Apprentice · More JavaScript terms at this level
Updated