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.

  1. Assign it a default string value of "Guest".
  2. Return a string exactly matching "Hello, [name]".
  3. If no name is provided, it should return "Hello, Guest".

Constraints

    FundamentalsFunctions
    JavaScript
    Loading...
    3 Hidden

    Input Arguments

    nameundefined

    Expected Output

    Hello, Guest

    Click RUN to test your solution