All academies
All challenges

Default and Optional Parameters

easyfunctions50 XP

Problem

Write greet(name: string, greeting?: string): string that returns a message like "Hello, Ada!". If no greeting is provided, default to "Hello". Use a default parameter value rather than checking for undefined inside the body.

Expected output

Hello, Ada!
Hi, Grace!

Hints

Stuck? Reveal hints one at a time.

Solution

Try solving it yourself first — revealing is always available.

Press Run in the editor — your console output is checked automatically.
No errors
Loading...

Console output appears here. Press Run or just type — the code compiles automatically.