Function Returns
Return sends a value back and ends the current call. A function with no explicit return produces undefined.
Where to run this
This example uses the JavaScript console playground. Select Run to execute it; the example does not run on this lesson page.
A practical example
function remaining(capacity, booked) {
return capacity - booked;
}
console.log(remaining(12, 5));
What happens
The caller receives 7.