return value Last updated: 30. May 2026

Keyword

Used in function statements and API function files.

Parameters

Name Type Description
value any

Value to return

Returns

Exits function or API JS file and returns the value.

Example

Code example (JS)

JS is normal JavaScript either running in the browser or on the Docly™ server.
function add(a, b) {
    return a + b; // Exits the function and returns the sum
}

write(add(2, 3)); // Outputs 5

Output

The JS code above produces the output shown below:
5