JavaScript standard library (ii) "Object" __java

Source: Internet
Author: User
Tags object object wrapper

Object constructor to create a wrapper. Grammar

Object initializer (initialiser) or object literal (literal)
{[namevaluepair1[, namevaluepair2[, ... ... Namevaluepairn]]]} 

// Call new Object in constructor form
([value])
Parameters
NameValuePair1, NameValuePair2, ... Namevaluepairn

A pair of names (strings) and a value (any value), where the name is delimited by a colon and a value.

Value

Any value. Description

The object constructor creates a wrapper for the given value. If the given value is null or undefined, an empty object will be created and returned, otherwise, an object of the type corresponding to the given value will be returned.

object is equivalent to new object () when invoked as a non-constructor.

You can view object initialization/literal syntax. properties of the object constructor

Object.length
Value is 1.

Object.prototype
You can add properties for all objects of type object. method of the object constructor

object.assign ()
Creates a new object by copying one or more objects.
object.create ()
Creates a new object using the specified prototype object and properties.
Object.defineproperty ()
Adds a property to an object and specifies the configuration of the property.
object.defineproperties ()
Add multiple properties to an object and specify their configuration, respectively.
object.entries ()
Returns a [key, value] array of enumerable properties for the given object.
Object.freeze ()
Frozen object: Other code cannot delete or change any properties.
Object.getownpropertydescriptor ()
Returns the property configuration specified by the object.
object.getownpropertynames ()
Returns an array that contains the enumerable or enumerable property names of the specified object.
Object.getownpropertysymbols ()
Returns an array that contains all the symbolic attributes of the specified object itself.
object.getprototypeof ()
Returns the prototype object for the specified object.
object.is ()
Compares two values to be the same. All NaN values are equal (this is different from = = and = = =).
object.isextensible ()
Determines whether an object can be expanded.
Object.isfrozen ()
Determine if the object has been frozen.
object.issealed ()
Determine if the object has been sealed.
Object.keys ()
Returns an array that contains the names of the enumerable properties of all given objects.
object.preventextensions ()
Prevents any extension of the object.
object.seal ()
Prevents other code from deleting an object's properties.
object.setprototypeof ()
Sets the prototype of the object (that is, the internal [[Prototype]] property).
object.values ()
Returns an array of enumerable values for the given object.instances of object and object prototypes

All objects in JavaScript are from object, and all objects inherit methods and properties from Object.prototype, although they may be overwritten. For example, a prototype of another constructor overrides the constructor property and provides its own ToString () method. Changes to object prototype objects propagate to all objects unless the properties and methods of these changes are further overwritten along the prototype chain. Property

Object.prototype.constructor
A specific function that is used to create a prototype of an object.
object.prototype._proto_
Refers to the object that is used as a prototype when an object is instantiated.
Object.prototype._nosuchmethod_
A function that is allowed to be defined and executed when an undefined object member is called as a method.
Object.prototype._count_
The number of properties that are used to directly return a number of attributes in a user-defined object. has been abolished.
Object.prototype._parent_
Used to point to the contents of an object. has been abolished. Method

Object.prototype._definegetter_ ()
Associates a function to a property. When the function is accessed, the function is executed and its return value is returned.
Object.prototype._definesetter_ ()
Associates a function to a property. When the function is set, the function that modifies the property is executed.
Object.prototype._lookupgetter_ ()
Return to useDefinegetterThe method function that is defined.
Object.prototype._lookupsetter_ ()
Return to useDefinesetterThe method function that is defined.
Object.prototype.hasOwnProperty ()
Returns a Boolean value that indicates whether an object contains a specified property, and this property is not inherited by a prototype chain.
Object.prototype.isPrototypeOf ()
Returns a Boolean value that indicates whether the specified object is in the prototype chain of this object.
Object.prototype.propertyIsEnumerable ()
Determines whether the specified property is enumerable, and the internal property setting is shown in ECMAScript [[Enumerable]] attribute.
Object.prototype.toSource ()
Returns a String representing the form of the source code for this object, which can be used to generate a new, identical object.
Object.prototype.toLocaleString ()
Call the ToString () method directly.
Object.prototype.toString ()
Returns a string representation of an object.
Object.prototype.unwatch ()
Removes the listener for a property of an object.
Object.prototype.valueOf ()
Returns the original value of the specified object.
Object.prototype.watch ()
Adds a listener to an object's properties.
Object.prototype.eval ()
Executes the JavaScript string code in the context of the specified object, and is deprecated.Sample the given undefined and null types use Object

The following example saves an empty object object to O:

var o = new Object ();
var o = new Object (undefined);
var o = new Object (null);
using object to generate a Boolean object

The following example saves a Boolean object to O:

Equivalent to o = new Boolean (true);
var o = new Object (true);
Equivalent to o = new Boolean (false);
var o = new Object (Boolean ());
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.