The Backup Name
Easy+20 XP
Mission Briefing
The planetary greeting protocol keeps failing when anonymous ships arrive without broadcasting their names. You need to assign it a fallback identifier so it doesn't crash!
The Concept: Default Parameters
You can assign a default value directly to a parameter in the function declaration. If the caller glitched or forgot to pass an argument, the function will use the default instead of undefined.
Example: function greet(name = "Stranger")
The Objective
Your function receives a name parameter.
- Assign it a default string value of "Guest".
- Return a string exactly matching "Hello, [name]".
- If no name is provided, it should return "Hello, Guest".
Constraints
FundamentalsFunctions
JavaScriptSystem handles I/O — write your function only
Loading...
3 Hidden
Input Arguments
nameundefined
Expected Output
Hello, Guest
Click RUN to test your solution