Beginner
Writing Your First Function
Description
In this challenge, you'll learn how to define and use functions in JavaScript.
Functions allow you to write reusable blocks of code that perform a specific task.
Your task is to write a function named greetUser that takes a user's name as input and returns a greeting message. Functions are a fundamental part of programming, helping to structure code efficiently and avoid repetition.
Example usage:
greetUser("Alice"); // Expected output: "Hello, Alice!"greetUser("Bob"); // Expected output: "Hello, Bob!"greetUser(""); // Expected output: "Hello, Guest!"
Did you know?
The first-ever website was created by Tim Berners-Lee for the internet.
Test Cases
Input:
"Bob"
Expected Output:
"Hello, Bob!"