Exerpad
🔥 1
10 XP
Lesson · Chapter: Hello, World!+10 XP for reading

What is JavaScript?

JavaScript is the programming language of the web! Every website you visit uses JavaScript to make things interactive and fun.

Where you'll use this
Every message a game shows you, every receipt, every chat reply — a program printed it. console.log() is how code talks to people.

Why Learn JavaScript?

  • It makes websites come alive with animations and interactivity
  • You can build games, apps, and even robots with it!
  • It runs right in your web browser — no extra setup needed

Your First JavaScript Code

Here's the simplest JavaScript program:

javascript
console.log("Hello, World!");
Output
Press Run to see the output.

console.log() is how JavaScript displays messages — it's how your program talks to you! Try running it!

You can use single quotes too:

javascript
console.log('Hello!');
Output
Press Run to see the output.

Printing Numbers

You can log numbers without quotes:

javascript
console.log(42);
console.log(3.14);
Output
Press Run to see the output.

Printing Multiple Things

Use commas to log several things on one line. JavaScript adds spaces between them:

javascript
console.log("I am", 10, "years old");
Output
Press Run to see the output.

Output:

I am 10 years old

Multiple Lines

Each console.log() starts a new line:

javascript
console.log("Line 1");
console.log("Line 2");
console.log("Line 3");
Output
Press Run to see the output.

Blank Lines

Call console.log() with nothing inside to print a blank line:

javascript
console.log("Top");
console.log();
console.log("Bottom");
Output
Press Run to see the output.

Output:

Top

Bottom

Fun Fact

JavaScript was created in just 10 days by Brendan Eich in 1995! Despite its name, JavaScript is NOT related to Java — they're completely different languages.

Now let's practice!

Did you know?
JavaScript was created in just 10 days in 1995 by Brendan Eich — and today it runs on billions of devices. Probably the most-run code in human history was written in a week and a half.

Check yourself

Pause & predict — what will this print?
console.log("3 + 4");