Function Return Value Quiz
Multiple Choice Beginner
Question
What does this function return? `function f() { let x = 5; }`
Hint
No return statement means no explicit return value.
Explanation
A function without a return statement returns undefined in JavaScript. The variable x is created inside the function but never returned. To get 5 back, you would need return x; or return 5; as the last line.
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.