Object properties and methods

    Objects in Js can be created through the new operator, such as creating an Object object:
        var obj = new Object();
    If you don't need to pass parameters during construction, you can also omit the parentheses (but not recommended). Each instance of an Object object has the following properties and methods.
    * constructor(): holds the constructor used to create the current object.
    * hasOwnProperty(propertyName): Used to check whether the current instance owns the given property.
    * isPrototypeOf(object): Used to check if the passed in object is the prototype of another object.
    * propertyIsEnumerable(propertyName): Checks whether the given property can be enumerated using a for-in statement.
    * toLocaleString(): Returns a string representation of the object that corresponds to the locale of the execution environment.
    * toString(): Returns the string representation of the object.
    * valueOf(): Returns the string, numeric or boolean representation of the object, usually the same as the return value of toString.
    Because Object is the basis of all objects, all objects have these basic properties and methods (objects in the browser environment, such as objects in the BOM and DOM, belong to the host object, because they are provided and defined by the host implementation , so may not inherit Object).

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326199018&siteId=291194637