as a developer

#JAVASCRIPT

OBJECT METHODS

Everything you need to master Objects in JS

as a developer

Object.create()

The Object.create() method is used to create a new ย object and link it to the prototype of an existing objet. We can create a job object instance, and extend it to a more specific object.

as a developer

Object.keys()

Object.keys() creates an array containing the keys of an object. We create an object and print the arrays of keys

as a developer

Object.values()

Object.values() creates an array containing the values of an object.

as a developer

Object.entries()

Object.entries() creates a nested array of the key / value pairs of an object.

as a developer

Object.assign()

Object.assign() is used to copy values from one object to another. We create two objects, and merge them with Object.assign()

as a developer

Object.freeze()

Object.freeze() prevents modification to properties and values of an object, and prevent properties from being added or removed from an object.

as a developer

Object.seal()

Object.seal() prevents new properties from being added to an object, but allows the modification of existing properties. This method is similar to Object.freeze(). Refresh your console before implementing the code below to avoid any error

as a developer

Object.getPrototypeOf()

Object.getPrototypeOf() is used to get the internal hidden [[Prototype]] of an object, also accessible through the __proto__ property. In this example, we can create an array, which has access to the Array prototype.

as a developer

Object.setPrototypeOf()

Object.setPrototypeOf() static method sets the prototype (i.e., the internal [[Prototype ]] property) of a specified object to another object or null.

as a developer

Enjoyed this?

1. Visit Saqibz.com 2. Subscribe to our newsletter 3. Never miss a Post