Overview - Return values
What is it?
Return values are the results that a function sends back after it finishes running. When you call a function, it can do some work and then give you a value to use later. This value is called the return value. If a function does not explicitly return something, it returns undefined by default.
Why it matters
Return values let functions communicate results to the rest of the program. Without return values, functions could only do things inside themselves but never share outcomes. This would make programs less flexible and harder to build because you couldn't reuse or combine results easily.
Where it fits
Before learning return values, you should understand what functions are and how to call them. After mastering return values, you can learn about function parameters, callbacks, and how to chain functions together for more complex tasks.