Function Without Return
Multiple Choice Easy
Question
What does function f() { let x = 1; } return when called?
Hint
No explicit return means undefined.
Explanation
A function without a return statement implicitly returns undefined. This is a common source of bugs when you forget to add return. In contrast, arrow functions with a single expression body like (x => x * 2) implicitly return the expression value.
Related Resources
Related Lessons
- Functions
Learn how functions work in programming.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.