New programmers · 8 min
Functions
Group reusable steps into functions, pass information with parameters and return a result.
Identify a function’s parameter, argument and returned value in a small example.
Define a reusable operation
A function packages steps under a name. Parameters are the named inputs in its definition.
Example
function double(number) { return number * 2; }
Pass an argument
An argument is the actual value supplied when a function is called.
Example
double(4) passes 4 as the number argument.
Return a result
A return statement sends a value back to the caller. Code after return in that function call does not run.
Example
const result = double(4); // result is 8
Knowledge check
Try it yourself
Your answer stays on this device.
About this lesson
Source: Original GyanStudio learning material. Editorial review pending. Last updated 5 November 2026.
This learning preview is not an official exam notice or a substitute for checking the relevant authority’s current information.