Parameters are variables listed as part of the function declaration. They are placeholders for values that will be provided when the function is called. Parameters are specified within the parentheses () following the function name.
function functionName(parameter1, parameter2, parameter3) {
// code to be executed
}
function add(a, b) {
return a + b;
}
var result = add(3, 4);
console.log(result); // 7
Arguments are the actual values that are passed to a function when it is called. They correspond to the parameters of the function. When a function is called, the arguments are provided within the parentheses ().
function_name(argument1, argument2, ...);
function add(a, b) {
return a + b;
}
var result = add(3, 4);
console.log(result); // 7