diff options
Diffstat (limited to 'files/he/web/javascript/reference/global_objects/object/index.html')
| -rw-r--r-- | files/he/web/javascript/reference/global_objects/object/index.html | 184 |
1 files changed, 0 insertions, 184 deletions
diff --git a/files/he/web/javascript/reference/global_objects/object/index.html b/files/he/web/javascript/reference/global_objects/object/index.html deleted file mode 100644 index 9feed92ddc..0000000000 --- a/files/he/web/javascript/reference/global_objects/object/index.html +++ /dev/null @@ -1,184 +0,0 @@ ---- -title: Object -slug: Web/JavaScript/Reference/Global_Objects/Object -tags: - - Constructor - - JavaScript - - NeedsTranslation - - Object - - TopicStub -translation_of: Web/JavaScript/Reference/Global_Objects/Object ---- -<div>{{JSRef}}</div> - -<p>The <code><strong>Object</strong></code> constructor creates an object wrapper.</p> - -<h2 id="Syntax">Syntax</h2> - -<pre class="syntaxbox">// Object initialiser or literal -{ [ <var>nameValuePair1</var>[, <var>nameValuePair2</var>[, ...<var>nameValuePairN</var>] ] ] } - -// Called as a constructor -new Object([<var>value</var>])</pre> - -<h3 id="Parameters">Parameters</h3> - -<dl> - <dt><code>nameValuePair1, nameValuePair2, ... nameValuePair<em>N</em></code></dt> - <dd>Pairs of names (strings) and values (any value) where the name is separated from the value by a colon.</dd> - <dt><code>value</code></dt> - <dd>Any value.</dd> -</dl> - -<h2 id="Description">Description</h2> - -<p>The <code>Object</code> constructor creates an object wrapper for the given value. If the value is {{jsxref("null")}} or {{jsxref("undefined")}}, it will create and return an empty object, otherwise, it will return an object of a Type that corresponds to the given value. If the value is an object already, it will return the value.</p> - -<p>When called in a non-constructor context, <code>Object</code> behaves identically to <code>new Object()</code>.</p> - -<p>See also the <a href="/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer">object initializer / literal syntax</a>.</p> - -<h2 id="Properties_of_the_Object_constructor">Properties of the <code>Object</code> constructor</h2> - -<dl> - <dt><code>Object.length</code></dt> - <dd>Has a value of 1.</dd> - <dt>{{jsxref("Object.prototype")}}</dt> - <dd>Allows the addition of properties to all objects of type Object.</dd> -</dl> - -<h2 id="Methods_of_the_Object_constructor">Methods of the <code>Object</code> constructor</h2> - -<dl> - <dt>{{jsxref("Object.assign()")}}</dt> - <dd>Copies the values of all enumerable own properties from one or more source objects to a target object.</dd> - <dt>{{jsxref("Object.create()")}}</dt> - <dd>Creates a new object with the specified prototype object and properties.</dd> - <dt>{{jsxref("Object.defineProperty()")}}</dt> - <dd>Adds the named property described by a given descriptor to an object.</dd> - <dt>{{jsxref("Object.defineProperties()")}}</dt> - <dd>Adds the named properties described by the given descriptors to an object.</dd> - <dt>{{jsxref("Object.entries()")}}</dt> - <dd>Returns an array containing all of the <code>[key, value]</code> pairs of a given object's <strong>own</strong> enumerable string properties.</dd> - <dt>{{jsxref("Object.freeze()")}}</dt> - <dd>Freezes an object: other code can't delete or change any properties.</dd> - <dt>{{jsxref("Object.fromEntries()")}}</dt> - <dd>Returns a new object from an iterable of key-value pairs (reverses {{jsxref("Object.entries")}}).</dd> - <dt>{{jsxref("Object.getOwnPropertyDescriptor()")}}</dt> - <dd>Returns a property descriptor for a named property on an object.</dd> - <dt>{{jsxref("Object.getOwnPropertyDescriptors()")}}</dt> - <dd>Returns an object containing all own property descriptors for an object.</dd> - <dt>{{jsxref("Object.getOwnPropertyNames()")}}</dt> - <dd>Returns an array containing the names of all of the given object's <strong>own</strong> enumerable and non-enumerable properties.</dd> - <dt>{{jsxref("Object.getOwnPropertySymbols()")}}</dt> - <dd>Returns an array of all symbol properties found directly upon a given object.</dd> - <dt>{{jsxref("Object.getPrototypeOf()")}}</dt> - <dd>Returns the prototype of the specified object.</dd> - <dt>{{jsxref("Object.is()")}}</dt> - <dd>Compares if two values are the same value. Equates all NaN values (which differs from both Abstract Equality Comparison and Strict Equality Comparison).</dd> - <dt>{{jsxref("Object.isExtensible()")}}</dt> - <dd>Determines if extending of an object is allowed.</dd> - <dt>{{jsxref("Object.isFrozen()")}}</dt> - <dd>Determines if an object was frozen.</dd> - <dt>{{jsxref("Object.isSealed()")}}</dt> - <dd>Determines if an object is sealed.</dd> - <dt>{{jsxref("Object.keys()")}}</dt> - <dd>Returns an array containing the names of all of the given object's <strong>own</strong> enumerable string properties.</dd> - <dt>{{jsxref("Object.preventExtensions()")}}</dt> - <dd>Prevents any extensions of an object.</dd> - <dt>{{jsxref("Object.seal()")}}</dt> - <dd>Prevents other code from deleting properties of an object.</dd> - <dt>{{jsxref("Object.setPrototypeOf()")}}</dt> - <dd>Sets the prototype (i.e., the internal <code>[[Prototype]]</code> property).</dd> - <dt>{{jsxref("Object.values()")}}</dt> - <dd>Returns an array containing the values that correspond to all of a given object's <strong>own</strong> enumerable string properties.</dd> -</dl> - -<h2 id="Object_instances_and_Object_prototype_object"><code>Object</code> instances and <code>Object</code> prototype object</h2> - -<p>All objects in JavaScript are descended from <code>Object</code>; all objects inherit methods and properties from {{jsxref("Object.prototype")}}, although they may be overridden. For example, other constructors' prototypes override the <code>constructor</code> property and provide their own <code>toString()</code> methods. Changes to the <code>Object</code> prototype object are propagated to all objects unless the properties and methods subject to those changes are overridden further along the prototype chain.</p> - -<h3 id="Properties">Properties</h3> - -<div>{{page('/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/prototype', 'Properties') }}</div> - -<h3 id="Methods">Methods</h3> - -<div>{{page('/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/prototype', 'Methods') }}</div> - -<h2 id="Deleting_a_property_from_an_object">Deleting a property from an object</h2> - -<p>There isn't any method in an Object itself to delete its own properties (e.g. like <code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/delete">Map.prototype.delete()</a></code>). To do so one has to use the <a href="/en-US/docs/Web/JavaScript/Reference/Operators/delete">delete operator</a>.</p> - -<h2 id="Examples">Examples</h2> - -<h3 id="Using_Object_given_undefined_and_null_types">Using <code>Object</code> given <code>undefined</code> and <code>null</code> types</h3> - -<p>The following examples store an empty <code>Object</code> object in <code>o</code>:</p> - -<pre class="brush: js">var o = new Object(); -</pre> - -<pre class="brush: js">var o = new Object(undefined); -</pre> - -<pre class="brush: js">var o = new Object(null); -</pre> - -<h3 id="Using_Object_to_create_Boolean_objects">Using <code>Object</code> to create <code>Boolean</code> objects</h3> - -<p>The following examples store {{jsxref("Boolean")}} objects in <code>o</code>:</p> - -<pre class="brush: js">// equivalent to o = new Boolean(true); -var o = new Object(true); -</pre> - -<pre class="brush: js">// equivalent to o = new Boolean(false); -var o = new Object(Boolean()); -</pre> - -<h2 id="Specifications">Specifications</h2> - -<table class="standard-table"> - <tbody> - <tr> - <th scope="col">Specification</th> - <th scope="col">Status</th> - <th scope="col">Comment</th> - </tr> - <tr> - <td>{{SpecName('ES1')}}</td> - <td>{{Spec2('ES1')}}</td> - <td>Initial definition. Implemented in JavaScript 1.0.</td> - </tr> - <tr> - <td>{{SpecName('ES5.1', '#sec-15.2', 'Object')}}</td> - <td>{{Spec2('ES5.1')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ES6', '#sec-object-objects', 'Object')}}</td> - <td>{{Spec2('ES6')}}</td> - <td>Added Object.assign, Object.getOwnPropertySymbols, Object.setPrototypeOf, Object.is</td> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-object-objects', 'Object')}}</td> - <td>{{Spec2('ESDraft')}}</td> - <td>Added Object.entries, Object.values and Object.getOwnPropertyDescriptors.</td> - </tr> - </tbody> -</table> - -<h2 id="Browser_compatibility">Browser compatibility</h2> - -<div> - - -<p>{{Compat("javascript.builtins.Object")}}</p> -</div> - -<h2 id="See_also">See also</h2> - -<ul> - <li><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer">Object initializer</a></li> -</ul> |
