JSObject

JSObject is the type of JavaScript objects in the JSAPI.

Objects are made up of the following parts:

  • Most objects have a prototype. See JS_GetPrototype. An object inherits properties, including methods, from its prototype (which is another object).
  • Most objects have a parent. See JS_GetParent. An object's parent is another object, usually either the global object or an object that represents an activation record. The JavaScript engine sometimes uses this relationship to implement lexical scoping. Security-sensitive applications can use this relationship to make every object a member of some security domain.
  • Almost every object can have any number of its own properties. The term own property refers to a property of an object that is not inherited from its prototype. Each property has a name, a getter, a setter, and property attributes. Most properties also have a stored value. See JS_DefineProperty.
  • Every object is associated with a JSClass and a JSObjectOps. These are C/C++ hooks and metadata that govern various aspects of the object's behavior and describe its layout in memory.