User Tools

Site Tools


javascript_es5_object_methods

JavaScript ES5 Object Methods

From https://www.w3schools.com/js/js_object_es5.asp

also see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object and check out the left panel under “Methods”

// Adding or changing an object property
Object.defineProperty(object, property, descriptor)

// Adding or changing many object properties
Object.defineProperties(object, descriptors)

// Accessing Properties
Object.getOwnPropertyDescriptor(object, property)

// Returns all properties as an array
Object.getOwnPropertyNames(object)

// Returns enumerable properties as an array
Object.keys(object)

// Accessing the prototype
Object.getPrototypeOf(object)

// Prevents adding properties to an object
Object.preventExtensions(object)
// Returns true if properties can be added to an object
Object.isExtensible(object)

// Prevents changes of object properties (not values)
Object.seal(object)
// Returns true if object is sealed
Object.isSealed(object)

// Prevents any changes to an object
Object.freeze(object)
// Returns true if object is frozen
Object.isFrozen(object)
javascript_es5_object_methods.txt · Last modified: 2018/09/24 15:57 by 119.94.100.2