JavaScript is the programming language of the web. Every browser runs it, and with Node.js it runs on servers too — which makes it the only major language that covers an entire application from front to back.
- Runs everywhere — browsers, servers (Node.js), mobile (React Native), desktop (Electron)
- Instant feedback — write code, refresh nothing, see results
- Massive ecosystem — npm hosts millions of packages
- The web's default — 98%+ of websites use it
Your first program
The classic first step — printing output. In real projects you use
console.log() and read the results in the browser's DevTools console:
console.log("Hello, World!");This box is live — edit the code above and the preview re-runs
instantly. Change "friend" to your own name. Break something on purpose:
errors show up as a red banner at the bottom of the preview.
How JavaScript reaches the browser
You rarely run JS in isolation — it rides inside HTML via a <script> tag:
<!DOCTYPE html>
<html>
<body>
<h1>My page</h1>
<script src="app.js"></script> <!-- external file -->
<script>
console.log("inline script also works");
</script>
</body>
</html>src="app.js" loads an external file — the standard approach for anything
beyond a few lines. Scripts at the end of <body> run after the HTML above
them exists, which matters when the code manipulates the page (chapter 5).
Comments
// A single-line comment
/* A multi-line comment
spans as many lines
as you need */What you'll learn
This course builds up in order: values and types → control flow → functions → arrays & objects → the DOM → asynchronous code → modern syntax → error handling. Every concept gets runnable examples you can edit right on the page.
Knowledge Check
4 questions — test your understanding
Where can JavaScript run?
What does console.log("Hi") do?
How do you load an external app.js file into a page?
Which of these is a valid single-line comment?
Next: Variables & Types