Skip to content
All challenges
ProgrammingWrite codeBeginner4 min

Greet a guest

Skills: Variables and scope · Strings

Task

A variable called guest already holds a name. Print one line that welcomes that guest, for example Welcome, Ana! when guest is "Ana".

Do not declare guest yourself: the tests set it to a different name each time.

Examples

Run examples tries these. Check solution also runs 2 more tests.

  1. Welcomes AnaExample
    Given
    guest = "Ana"
    Expected output
    Welcome, Ana!

Every test, including the extra ones, is part of this page. Nothing is hidden or secret.

Your code

Loading the editor…

// guest already exists. Print the welcome line.

Ctrl + Enter (⌘ + Enter on a Mac) runs the examples; add Shift to check. Tab indents; press Esc, then Tab, to leave the editor.

Run examples tries your code on the examples and records nothing. Check solution runs every test and saves an attempt.

Tests

Run your code to see which tests pass.

Console

What your code logs with console.log appears here.