javascript
javascript
Function Parameters And Returns in Javascript
Live
bolt
Level1
Progress0%

Function Parameters And Returns in Javascript

CARD 1

Introduction

Login to report note issues for this section.

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 arguments

Parameters 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.