argument vs parameter


A parameter is the variable belonging to the declaration of a function.
An argument is the actual value of the parameter that is passed to the function.
Assume that we have a function that calculates the sum of two numbers:
const sum = function(a, b) {
    return a + b;
here a and b are the parameters. If we call the function, sum(1, 2), then 1 and 2 are the arguments.


There is a handy memory hook to distinguish these terms:
Parameter → Placeholder
Argument → Actual value
Hit the Subscribe button for the latest news on my tools. No spam. Ever!
© 2020 Nguyen Huu Phuoc. All rights reserved