JavaScript Coding Tutorial

Learn the basics of JavaScript with this simple guide.

Code Example

The following code defines a function that greets a user by their name:


function greet(name) {
    console.log("Hello, " + name + "!");
}

            

Keyboard Shortcuts

To save your code, press Ctrl + S.

Program Output

When you run the function with greet("Alice"), you will see this output:

Hello, Alice!

Working with Variables

In JavaScript, variables can be declared using var, let, or const. For example:


let age = 25;
console.log("Age: " + age);