JavaScript: Object Overview

By Xah Lee. Date: . Last updated: .

This page is a overview of JavaScript object system. It's called prototype-based object system.

If you don't know how to create object, read properties, first see: Object Tutorial .

What is JavaScript Object

A JavaScript Object is a collection of key/value pairs. e.g. {a:1, b:2}. Each key/value pair is called a Property .

Special Object and Data Object

JavaScript objects can be categorized into 2 kinds:

[see Object Type]

Prototype of an Object (Parent)

[see Prototype and Inheritance]

IsExtensible

Each object has a special true/false value attached called the [[isExtensible]] internal slot. It specifies whether new properties can be added to the object.

[see Prevent Adding Property]

Standard Object, Hosted Object, User-Created Object

It is useful to distinguish objects by where they came from. We have the following sources:

Standard Object
Objects from the JavaScript language. For example, arrays, functions, dates, regex, Math, etc. [see JavaScript Object Reference]
Hosted Object
Objects from the hosting environment. For example, in Browser, there's Browser's Window Object. In deno, there is deno object, with properties such as version etc.
User-defined Object (Data Object)
User defined. For example, let x = {a:1, b:2}.

Create Object

JavaScript Object Property Overview

JavaScript Object and Inheritance

BUY Ξ£JS JavaScript in Depth