JS Coding Questions Logo
JS Coding Questions
#343💼 Interview💻 Code

What is the difference between a parameter and an argument

Advertisement

728x90

Parameter is the variable name of a function definition whereas an argument represents the value given to a function when it is invoked. Let's explain this with a simple function

javascript
1function myFunction(parameter1, parameter2, parameter3) {
2  console.log(arguments[0]); // "argument1"
3  console.log(arguments[1]); // "argument2"
4  console.log(arguments[2]); // "argument3"
5  }
6
7myFunction("argument1", "argument2", "argument3");

Advertisement

Responsive Ad
🎯 Practice NowRelated Challenge

JavaScript Coding Exercise 86

Test your knowledge with this interactive coding challenge.

Start Coding

Advertisement

728x90
343of476
What is the difference between a parameter and an argument | JSCodingQuestions.com