Default Parameter Quiz
Multiple Choice Medium
Question
What does this print? `function f(x = 10) { return x; } console.log(f());`
Hint
Default parameters provide a value when no argument is given.
Explanation
When no argument is passed, the default parameter value is used. f() calls the function with no argument, so x defaults to 10. The function returns 10, and console.log prints: 10
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.