0
0
Javascriptprogramming~15 mins

What is JavaScript - Hands-On Activity

Choose your learning style9 modes available
What is JavaScript
📖 Scenario: Imagine you want to make a website that can do things like show messages, change colors, or respond when you click buttons. JavaScript is the tool that helps you do that.
🎯 Goal: You will write simple JavaScript code to show a message on the screen. This will help you understand what JavaScript is and how it works in a webpage.
📋 What You'll Learn
Create a variable to hold a greeting message
Create a function to show the greeting message
Call the function to display the message
Use console.log to output the message
💡 Why This Matters
🌍 Real World
JavaScript is used to make websites interactive, like showing messages, responding to clicks, or updating content without reloading the page.
💼 Career
Knowing JavaScript is essential for web developers because it is the main language for adding behavior to websites.
Progress0 / 4 steps
1
Create a variable with a greeting message
Create a variable called greeting and set it to the string 'Hello, JavaScript!'.
Javascript
Need a hint?

Use const to create a variable that does not change.

2
Create a function to show the greeting
Create a function called showGreeting that uses console.log(greeting) to display the greeting message.
Javascript
Need a hint?

Define a function using the function keyword and call console.log inside it.

3
Call the function to display the message
Call the function showGreeting() to display the greeting message in the console.
Javascript
Need a hint?

Just write the function name followed by parentheses to call it.

4
See the greeting message output
Run the code and observe the output in the console. It should show Hello, JavaScript!.
Javascript
Need a hint?

Open your browser console or run the code in a JavaScript environment to see the message.