Object Flashcards
Object.prototype.hasOwnProperty()
Determine whether the object has property as a direct property.
params: prop
Note: In contrast with in, this does not check down the property chain
Object.getOwnPropertyNames()
Returns all property names (enum or not) that are direct properties
params: obj
Object.assign()
Copy values of all enumerable own properties from source(s) to target object and return target object
params: target, …sources
Object.create()
Create a new object with proto and properties
params: proto[, propertiesObject]
propertiesObject
an object with enum own properties specifying property descriptors
Object.defineProperties()
Defines new or modifies existing properties directly on object. Returns the object.
params: obj, props
Object.defineProperty()
Define a new or modify an existing property directly on an object. Returns the object.
params: obj, prop, descriptor
obj the object to modify prop the prop name descriptor An object with data descriptors: - configurable (required, defaults to false) - enumerable (required, defaults to false) - value - writable and accessor descriptors: - get - set
Object.freeze()
Prevents new properties from being added, existing properties from being deleted or changed
params: obj
Object.getOwnPropertyDescriptor()
Returns a property descriptor for an own property
params: obj, prop
Object.getOwnPropertyNames()
Returns an array of all own string properties (enum or not)
params: obj
Object.getOwnPropertySymbols()
Returns as array of all own symbol properties
params: obj