JavaScript: the Global Object

By Xah Lee. Date: . Last updated: .

JavaScript the language defines a global object.

Purpose of Global Object

Global object holds all variable/object/function of the JavaScript language as properties.

Value of Global Object

What object is the Global Object depends on the language host.

In web browser, the Global Object is window. [see Browser Window Object]

In Deno, the Global Object is window.

In node.js, the Global Object is global. [see Node.js Tutorial]


globalThis (JS2020) is a variable that is alias to the Global Object.

console.log( globalThis === window); // true in browser

Constant Literals

Simple Functions

Static Objects

Primitive Wrapper

Special Objects

Error Objects


JavaScript in Depth