liveBook · Manning

Global object

As explained in Secrets of the JavaScript Ninja, Second Edition

The object that serves as the default top-level namespace and container for globally accessible bindings in a JavaScript environment.

In browser JavaScript, `window` is the global object: it provides access to global variables, other global objects, and browser APIs. Its `document` property represents the page’s DOM, which scripts can modify. section 2.2.2

var first = document.getElementById("first");

This example uses the global `document` object to find an element in the DOM. section 2.2.2

How Secrets of the JavaScript Ninja, Second Edition covers it

How deep it goes
Explains how `window` exposes globals and how `document` represents a modifiable DOM, but defers comprehensive browser API coverage.
Examples
Uses `document.getElementById("first")` to select an element for later modification.
What you can do after
Apply browser APIs through `window` and `document` to access and modify page elements.
How it connects
Connects `window` and `document` to global variables, browser APIs, and the DOM.

Also explained in

Compare how 2 books explain global object →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Secrets of the JavaScript Ninja, Second Edition. The section links point to the parts of the book it draws on.