0
0
Javascriptprogramming~15 mins

Writing first JavaScript program - Mini Project: Build & Apply

Choose your learning style9 modes available
Writing first JavaScript program
📖 Scenario: You want to create a simple program that greets a user by name. This is like saying hello to a friend when you meet them.
🎯 Goal: Build a JavaScript program that stores a name, creates a greeting message using that name, and then shows the greeting on the screen.
📋 What You'll Learn
Create a variable to store a name
Create a variable to store a greeting message using the name
Display the greeting message using console.log
💡 Why This Matters
🌍 Real World
Greeting users by name is common in websites and apps to make them feel welcome.
💼 Career
Knowing how to create variables, use strings, and display output is the foundation of programming in JavaScript.
Progress0 / 4 steps
1
Create a variable with a name
Create a variable called userName and set it to the string "Alice".
Javascript
Need a hint?

Use const to create a variable and assign the value "Alice" to userName.

2
Create a greeting message
Create a variable called greeting and set it to the string `Hello, ${userName}!` using a template literal.
Javascript
Need a hint?

Use backticks ` and ${} to insert the variable userName inside the string.

3
Display the greeting message
Use console.log to display the value of the variable greeting.
Javascript
Need a hint?

Use console.log(greeting); to print the greeting message to the console.

4
Run the program to see the greeting
Run the program and make sure the output is exactly Hello, Alice!.
Javascript
Need a hint?

Check the console output to see the greeting message.