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.

Lesson 1 of 38 steps

What is JavaScript? Engines (V8/SpiderMonkey) & Runtimes (Browser vs Node) is a free JavaScript Academy lesson on CoddyKit. This is lesson 1 of 3. Any 3 lessons of this learning path are free to read in full — after that, CoddyKit PRO unlocks every lesson, plus hands-on practice with a built-in code editor and a 24/7 AI tutor. It is part of the JavaScript Academy learning path, and your progress syncs across the web and the CoddyKit app. The JavaScript Academy course includes 3 lessons in total.

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.

Free to start

Learn JavaScript with an AI tutor — free

Write and run real code in your browser, get instant help from a 24/7 AI tutor, and pick up where you left off on the web or in the app.

Courses
59
Lessons
200

Frequently Asked Questions

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

Yes — any 3 lessons of the JavaScript Academy learning path, including “What is JavaScript? Engines (V8/SpiderMonkey) & Runtimes (Browser vs Node)”, are free to read in full here on the web. After that, CoddyKit PRO unlocks every lesson, plus interactive practice with a built-in code editor and a 24/7 AI tutor. The JavaScript Academy course includes 3 lessons in total.

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, so you can start here or from the beginning and move at your own pace. This is lesson 1 of 3.

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