javascript
Function Parameters And Returns in JavascriptjavascriptLevel1
Progress0%
Contents
Function Parameters And Returns in Javascript
1 / 11
Introduction
Parameters & Return
A parameter is a variable listed in a function's definition that acts as a placeholder for a value. An argument is the actual value passed to the function when it is called.
codejs
1function add(a, b) { // a and b are parameters
2 return a + b;
3}
4
5add(3, 4); // 3 and 4 are argumentsParameters and the return statement are the two primary ways a function communicates with the rest of the program — parameters bring data in, return sends data out.