Introduction to JavaScript

Uploaded : 3 months ago Updated : 3 months ago beginner

Take The Quiz

Take The Quiz

What is JavaScript?

JavaScript is the programming language of the web. HTML structures a page and CSS styles it; JavaScript makes it interactive — responding to clicks, updating content and talking to servers.

Where JavaScript runs

It runs in the browser (the front end) and, with Node.js, on servers too. One language, everywhere.

Variables: storing values

Declare values with let (can change) or const (cannot be reassigned). Avoid the old var.

const name = "Ada";
let score = 0;
score = 10;

Prefer const by default

Use const unless you know the value will change; it states your intent and prevents accidental reassignment.

Data types you will meet

  • String — text: "hello"
  • Number42, 3.14
  • Booleantrue / false
  • Array — a list: [1, 2, 3]
  • Object — key/value pairs: { name: "Ada" }

Your first script

<script>
  console.log("Hello from JavaScript!");
</script>

Open the console

Press F12 → Console to see console.log output and any errors. It is your most important debugging tool.

Frequently asked questions

Is JavaScript the same as Java?
No — despite the name, they are unrelated languages.
Do I need to install anything?
No, every browser runs JavaScript. For server-side JS you install Node.js.
let or const?
Use const by default; switch to let only when the value must change.

Ready for more?

Next, learn functions, conditions and loops — the core building blocks of any program.

Continue to JavaScript Fundamentals

Comments