« Back to Index

[The distinction between “arguments” and “parameters”]

View original Gist on GitHub

Tags: #args #params #vs

arguments vs parameters.js

/*
  Arguments are used when a function is being called. 
  We pass arguments to functions. 
  Parameters are set up when the function is defined. 
  So it is said that parameters are used to define a function and arguments are used to invoke a function. 
  These words are typically interchangeable but knowing the distinction can be handy.
*/

var myFunction = function(x,y,z){ // x,y,z are parameters
    return x+y+z
};

myFunction(1,2,3); // 1,2,3 are arguments