Learn JavaScript from Scratch, Part 1: Introduction and Setup

Learn JavaScript from scratch 2026 - CodingHumans

Want to learn JavaScript from scratch? This is Part 1 of our step-by-step series that takes you from zero to understanding how JavaScript really works — no prior programming needed. In this part you'll learn what JavaScript actually is, where it runs, and you'll write and run your first program in under five minutes.

Every part of this series ends with practice questions, because you only learn a language by using it. By the end of the series you'll be able to build interactive pages, understand interview favourites like closures and the event loop, and know what the engine does under the hood.

1. What JavaScript is (in plain words)

A web page is built from three languages that do three different jobs:

LanguageJobExample
HTMLThe content and structure"There is a button here with the text Buy."
CSSThe look"The button is green and rounded."
JavaScriptThe behaviour"When the button is clicked, add the item to the cart."

JavaScript is a programming language: you write instructions, and a program called an engine reads them top to bottom and carries them out. Everything that reacts on a page — menus opening, forms checking your email, feeds loading more posts as you scroll, the like count going up without a reload — is JavaScript running in your browser.

One line to remember: HTML is the skeleton, CSS is the skin, JavaScript is the muscles and brain.

Two beginner confusions, cleared up right away:

  • JavaScript is not Java. They are unrelated languages; the name was a 1995 marketing decision. Nothing from Java carries over.
  • You may see ECMAScript or "ES6": ECMAScript is the official standard that defines the language, and JavaScript is its implementation. ES6 (2015) was a big upgrade we'll use throughout this series.

2. What JavaScript can do

  • In the browser: react to clicks and typing, change the page without reloading, validate forms, fetch data from servers, draw charts and games.
  • On servers (Node.js): power APIs and backends — the same language on both sides is why full-stack JavaScript is so popular.
  • Beyond the web: mobile apps (React Native), desktop apps (Electron, which VS Code itself is built with), and automation scripts.

That range is why JavaScript has been among the most-used programming languages in the world for over a decade — and why it's a safe first language to invest in.

3. Where JavaScript runs: the engine

JavaScript doesn't run on its own — it always runs inside a host that provides an engine:

HostEngineUsed for
Chrome / EdgeV8Web pages
FirefoxSpiderMonkeyWeb pages
SafariJavaScriptCoreWeb pages
Node.jsV8 (outside the browser)Servers, tools, scripts

For now, one idea matters: the browser you already have is a complete JavaScript machine. You need zero installation to start. (In Part 20 we'll open up the engine itself — how V8 reads and speeds up your code.)

4. Your first program — 3 ways, nothing to install

Way 1: the browser console (fastest)

On this very page, press F12 (or right-click → Inspect) and open the Console tab. Type this and press Enter:

console.log("Hello, JavaScript!");

The console prints Hello, JavaScript!. You just ran JavaScript. console.log(...) means "print this so I can see it" — it will be your best friend for the whole series. Try two more lines:

2 + 3 * 4        // 14 - JavaScript follows math precedence
"Coding" + "Humans"  // "CodingHumans" - + also joins text

Anything after // is a comment — a note for humans that the engine ignores.

Way 2: JavaScript inside an HTML file

Create a file called hello.html, paste this, save, and double-click it to open in your browser:

<!DOCTYPE html>
<html>
  <body>
    <h1>My first page</h1>
    <script>
      let name = "CodingHumans";
      console.log("Hello, " + name);
      alert("Welcome to JavaScript!");
    </script>
  </body>
</html>

The <script> tag is how a page includes JavaScript. The browser reads the page top to bottom, and when it reaches the script, it runs it: an alert box pops up, and the greeting is printed in the console (F12 to see it).

Way 3: a separate .js file (how real projects do it)

<script src="app.js"></script>

Instead of writing code inside the HTML, real projects keep JavaScript in its own file (app.js) and link it with the src attribute. Same result, much cleaner — this is the style we'll use from Part 2 onwards.

5. Setting up like a developer (5 minutes)

  • Editor: install VS Code (free). It colours your code, catches typos, and autocompletes.
  • Extension: in VS Code, install Live Server — it opens your HTML in the browser and refreshes automatically every time you save.
  • Browser: any modern one works; keep the DevTools console (F12) open while you code.
  • Optional, for later: Node.js lets you run JavaScript outside the browser. You won't need it until much later in the series, so feel free to skip it today.
Checkpoint: if you can open the console, run console.log("ready"), and open an HTML file with a script tag — your setup is done.

6. How to use this series

  • Type every example yourself. Copy-paste teaches your eyes; typing teaches your fingers and brain.
  • Break things on purpose. Change values, remove quotes, see what errors look like — errors are information, not failure.
  • Do the practice questions at the end of every part before moving on. If you score under 4/6, skim the part once more.
  • One part a day is a good pace. The series runs from these basics to closures, this, prototypes, async and the engine itself.

Already know some frontend? Our Learn Frontend series gives the fast overview version; this series is the slow, deep one.

7. Practice: test what you learned

Q1. On a web page, what is JavaScript's job?

a) Structure and content

b) Colours and layout

c) Behaviour and interactivity

d) Storing the website's files

Q2. What is the relationship between Java and JavaScript?

a) JavaScript is a lighter version of Java

b) They are unrelated; the name was marketing

c) Java runs JavaScript inside it

d) JavaScript compiled becomes Java

Q3. What does console.log("hi") do?

a) Shows a popup to the visitor

b) Writes "hi" onto the web page

c) Saves "hi" into a file

d) Prints "hi" in the browser's developer console

Q4. Which JavaScript engine does Chrome use (the same one that powers Node.js)?

a) V8

b) SpiderMonkey

c) JavaScriptCore

d) Chakra

Q5. How do you include JavaScript in an HTML page?

a) <js>...</js>

b) <script>...</script> or <script src="app.js">

c) <javascript>...</javascript>

d) <code>...</code>

Q6. What does console.log(2 + 3 * 4) print?

a) 20

b) 24

c) 14

d) 2 + 3 * 4

FAQ

Can I learn JavaScript without knowing HTML and CSS?

Yes — this series explains the HTML you need as it appears. Knowing basic HTML helps from Part 10 (DOM) onwards, and you can pick it up in parallel with our Learn Frontend series.

Is JavaScript enough to get a job?

JavaScript is the core skill behind frontend, backend (Node.js) and mobile (React Native) roles. Jobs usually expect JavaScript plus a framework like React — which is exactly the path: this series first, then a framework.

How long does it take to learn JavaScript from scratch?

With one part a day and the practice questions, you'll cover the full series (basics to the engine) in about a month. Comfort comes from building things — start small projects from Part 10 onwards.

Do I need a powerful laptop?

No. A browser and VS Code run on almost anything. Everything in this series works on an average laptop — even a tablet with an online editor in a pinch.

Learning with others? Join the CodingHumans WhatsApp community to get each new part of Learn JavaScript as soon as it goes live.

Comments

Answered 0/0Correct 0