0Pricing
JavaScript Academy · Lesson

What is JavaScript? Engines (V8/SpiderMonkey) & Runtimes (Browser vs Node)

What JavaScript is, how engines execute it, and how Browser vs Node runtimes differ. Write your first tiny programs.

What is JavaScript? Engines (V8/SpiderMonkey) & Runtimes (Browser vs Node) is a free JavaScript Academy lesson on CoddyKit — lesson 1 of 3. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the JavaScript Academy learning path, one of 3 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Intro

Goal: Understand what JS is, how engines run it, and how Browser vs Node runtimes differ. You will write tiny, readable programs.

  • Engines: V8, SpiderMonkey
  • Runtimes: Browser, Node
  • First output

What is JavaScript?

JavaScript is a high-level, dynamically typed language standardized as ECMAScript. It powers interactive UIs in browsers and also runs on servers via Node.

First console output

Create a small function and print with console.log. Keep lines short for mobile.

// First tiny program: prints a greeting
function greet(name) {
  return "Hello, " + name + "!";
}

const msg = greet("CoddyKit");
console.log(msg);

Engines vs runtimes

Engine executes JS (e.g., V8, SpiderMonkey). Runtime adds host APIs: Browser gives DOM/fetch; Node gives fs/path.

Detecting the runtime

Check globals before using an API so the same code runs safely in both environments.

// Detect where code runs using simple globals
const inBrowser = typeof window !== "undefined" && typeof document !== "undefined";
const inNode = typeof process !== "undefined" && typeof process.versions === "object";

if (inBrowser) {
  console.log("Runtime: Browser (DOM available).");
}
if (inNode) {
  console.log("Runtime: Node (filesystem APIs available).");
}

Pick the right output

alert is browser-only; console.log works everywhere. Use a feature check.

// Use the right output method for each runtime
const text = "JS runs in different environments!";
const canAlert = typeof alert === "function";

if (canAlert) {
  alert(text); // Browser popup
} else {
  console.log(text); // Works in Node and browsers
}

Engine vs runtime quiz

Quick check: Engine vs runtime.

Recap

Recap: JS runs on engines inside different runtimes. You printed output, detected the environment, and learned which APIs belong to which host.

Frequently asked questions

Is the “What is JavaScript? Engines (V8/SpiderMonkey) & Runtimes (Browser vs Node)” lesson free?

Yes — the full text of “What is JavaScript? Engines (V8/SpiderMonkey) & Runtimes (Browser vs Node)” is free to read here on the web, and the JavaScript Academy course includes 3 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the JavaScript Academy course, upgrade to CoddyKit PRO.

What will I learn in “What is JavaScript? Engines (V8/SpiderMonkey) & Runtimes (Browser vs Node)”?

What JavaScript is, how engines execute it, and how Browser vs Node runtimes differ. Write your first tiny programs. You practise JavaScript Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start JavaScript Academy?

No prior experience is required. JavaScript Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 1 of 3, so you can start here or from the beginning and move at your own pace.

How long does the “What is JavaScript? Engines (V8/SpiderMonkey) & Runtimes (Browser vs Node)” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this JavaScript Academy lesson?

Yes. Every JavaScript Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. What is JavaScript? Engines (V8/SpiderMonkey) & Runtimes (Browser vs Node)
  2. Setup: Node + npm, Running .js, DevTools Console
  3. First Program & I/O (console, alerts in browser)
← Back to JavaScript Academy