Home  >  Article  >  Web Front-end  >  What are the object methods in javascript

What are the object methods in javascript

青灯夜游
青灯夜游Original
2021-04-12 12:00:359701browse

Object methods in JavaScript: assign(), create(), entries(), freeze(), getPrototypeOf(), is(), keys(), seal(), values(), isSealed() etc.

What are the object methods in javascript

The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer.

javascript object method

  • Object.assign()

    Create a new one by copying one or more objects object.

  • Object.create()

    Creates a new object using the specified prototype object and properties.

  • Object.defineProperty()

    Add a property to the object and specify the configuration of the property.

  • Object.defineProperties()

    Add multiple properties to the object and specify their configuration respectively.

  • Object.entries()

    Returns a [key, value] array of the given object's own enumerable properties.

  • Object.freeze()

    Freeze object: No other code can delete or change any properties.

  • Object.getOwnPropertyDescriptor()

    Returns the property configuration specified by the object.

  • Object.getOwnPropertyNames()

    Returns an array that contains all enumerable or non-enumerable property names of the specified object.

  • Object.getOwnPropertySymbols()

    Returns an array that contains all the symbol properties of the specified object itself.

  • Object.getPrototypeOf()

    Returns the prototype object of the specified object.

  • Object.is()

    Compares whether two values ​​are the same. All NaN values ​​are equal (this is different from == and ===).

  • Object.isExtensible()

    Determine whether the object is extensible.

  • Object.isFrozen()

    Determine whether the object has been frozen.

  • Object.isSealed()

    Determine whether the object has been sealed.

  • Object.keys()

    Returns an array containing the names of all the enumerable properties of the given object itself.

  • Object.preventExtensions()

    Prevent any extension of the object.

  • Object.seal()

    Prevent other code from deleting the object's properties.

  • Object.setPrototypeOf()

    Sets the object's prototype (i.e. the internal [[Prototype]] property).

  • Object.values()

    Returns an array of the given object's own enumerable values.

For more programming-related knowledge, please visit: Programming Video! !

The above is the detailed content of What are the object methods in javascript. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn