JSObject

  • Revision slug: SpiderMonkey/JSAPI_Reference/JSObject
  • Revision title: JSObject
  • Revision id: 88789
  • Created:
  • Creator: Jorend
  • Is current revision? No
  • Comment +private data, reserved slots

Revision Content

{{ Jsapi_ref_header("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 uses this relationship to implement lexical scoping.
  • 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, a JSObjectOps, and a JSObjectMap. These are C/C++ hooks and metadata that govern various aspects of the object's behavior and describe its layout in memory.

Revision Source

<p>{{ Jsapi_ref_header("JSObject") }}
</p><p><b><code>JSObject</code></b> is the type of JavaScript objects in the JSAPI.
</p><p>Objects are made up of the following parts:
</p>
<ul><li> Most objects have a <i>prototype</i>. See <code><a href="en/JS_GetPrototype">JS_GetPrototype</a></code>. An object inherits properties, including methods, from its prototype (which is another object).
</li></ul>
<ul><li> Most objects have a <i>parent</i>. See <code><a href="en/JS_GetParent">JS_GetParent</a></code>. An object's parent is another object, usually either the global object or an object that represents an activation record. The JavaScript engine uses this relationship to implement lexical scoping.
</li></ul>
<ul><li> Almost every object can have any number of its own properties. The term <i>own property</i> refers to a property of an object that is not inherited from its prototype. Each property has a name, a getter, a setter, and <a href="en/JS_GetPropertyAttributes">property attributes</a>. Most properties also have a <a href="en/JSAPI/Stored_value">stored value</a>. See <code><a href="en/JS_DefineProperty">JS_DefineProperty</a></code>.
</li></ul>
<ul><li> Every object is associated with a <code><a href="en/JSClass">JSClass</a></code>, a <code><a href="en/JSObjectOps">JSObjectOps</a></code>, and a <code><a href="en/JSObjectMap">JSObjectMap</a></code>. These are C/C++ hooks and metadata that govern various aspects of the object's behavior and describe its layout in memory.
</li></ul>
<ul><li> Depending on the <code>JSClass</code>, an object may have a <a href="en/JS_SetPrivate">private data pointer</a> and any number of <a href="en/JS_SetReservedSlot">reserved slots</a>.
</li></ul>
Revert to this revision