Function Parameters vs Arguments in JavaScript – What’s the Difference?

pushpesh kumarpushpesh kumar
2 min read

If you're just getting started with JavaScript, it's easy to get confused between parameters and arguments in functions. Don’t worry—they’re closely related but play different roles.

Let’s break it down with clear definitions and examples.


✅ Function Parameters

Parameters are the placeholders or variables listed inside the function definition.

Think of them as input labels your function expects.

function greet(name) {
  console.log("Hello, " + name);
}

🔹 In this example:

  • name is the parameter.

  • It's like a blank variable waiting to be filled when the function is called.


🧠 Function Arguments

Arguments are the actual values you pass to the function when you call it.

greet("Pushpesh");

🔹 Here:

  • "Pushpesh" is the argument.

  • It replaces the parameter name inside the function.


🧪 Another Example

function add(a, b) {   // a and b → parameters
  return a + b;
}

add(3, 4);             // 3 and 4 → arguments

📌 Result: The function returns 7, using the arguments 3 and 4.


🧠 Quick Summary

ConceptParameterArgument
Where?In the function definitionIn the function call
What?Named placeholder for inputActual value provided to function
Examplefunction greet(name)greet("Alice")

💬 Common Interview Tip

Parameters are what you define, arguments are what you pass.”

0
Subscribe to my newsletter

Read articles from pushpesh kumar directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

pushpesh kumar
pushpesh kumar