Introduction
Just as we would classify objects in our daily lives to have properties and methods is the same with javascript objects. Javascript objects are independent entities with properties and methods. The property is a relation between a name and a value. The property's value can be a function, the property can be known as a method.
Object methods
Object.assign()
This is an object method that copies all values and properties from one or more source objects to a target object.
Object.assign(target, sources)
target: The target object.
sources: The source object.
Object.create()
This is a method that creates a new object with the specified prototype object and properties.
Object.create(prototype[propertiesObject])
prototype: It is the prototype object from which a new object is to be created.
propertiesObject: This is optional. It specifies the enumerable properties to be added to the newly created object.
Object.entries()
This is an object method that returns an array of the object's own enumerable property the [key, value] pairs, in the same orders as that of a for in loop.
Object.entries(obj)
Obj: The object whose enumerable string property[key, value] pairs are to be returned.
Object.freeze()
This method freezes an object and prevents new properties from being added, removed, and prevents already existing properties from being changed.
Object.freeze(obj)
obj: This will freeze.
Object.isFrozen
This determines if the object has been assigned the freeze method.
Object.isFrozen(obj)
obj: The object to be checked
Object.defineProperty()
This method defines a new property directly on an object or modifies an existing property of an object and returns the object.
Object.defineProperty(obj, props, descriptor)
obj: The object to define the property.
Props: The name or symbol of the property to be defined or modified.
Descriptor: For the property being modified or defined.
Object.defineProperties()
This method defines new properties or modifies existing properties directly on an object.
Object.defineProperties(obj, props)
obj: the object on which properties are to be defined or modified.
Props: An object on whos enumerable property constitutes a descriptor for the properties to be defined or modified.
Object.fromEntries()
This method transforms a list of [key value] pairs into an object.
Object.fromEntries(iretable)
iterable: An iterable such as an array or map or other object applying the iterable protocol.
Object. is()
This object method is used to determine whether two values are the same.
Object.is(value1, value2)
value1: This is the first to compare.
value2: This is the second to compare.
Object.isExtensible()
This determines if an object can have new properties added to it.
Object.isExtensible(obj)
obj: The object to be checked.
###Object.preventExtensions This prevents new properties from being added to an object.
Object.preventExtensions(obj)
obj: The object to be made non-extensible.
Object.seal
This method seals an object which prevents new properties from being added to and marks all existing properties as non-configurable.
Object.seal(obj)
obj: It is the object to be sealed.
Object.isSealed()
This method determines if an object has the object method seal.
Object.sealed(obj)
obj: The object to be checked.
Object.Keys
This method returns an array whose elements are strings corresponding to the enumerable property name found directly on an object.
Object.keys(obj)
obj: The object of which the enumerable own properties is to be turned.
Object.getOwnPropertyDescriptor
This method returns a property descriptor for one directly present on an object and not in the object's prototype chain.
Object.getOwnPropertyDescriptor(obj, prop)
obj: The object to look for the property.
prop: The name or symbol of the property whose description is to be retrieved.
Object.getOwnPropertyDescriptors
This method returns all its own property descriptors of a given object.
Object.getOwnPropertyDescriptors(obj)
obj: THe object to get all its own property descriptors.
Object.getOwnPropertyNames
This method returns an array of all properties except those with symbols found directly on a given object.
Object.getOwnPropertyNames(obj)
obj: The object whose properties are to be returned.
Object.getOwnPropertySymbols()
This method returns an array of all symbols properties found directly upon a given object.
Object.getOwnPropertySymbols(obj)
obj: It is an object whose symbol properties are to be returned.
Conclusion
I hope this article has been helpful in understanding what javascript objects as acollection of properties and methods is all about.