// Copies properties from a source object to a target object Object.assign(target, source) // Creates an object from an existing object Object.create(object) // Returns an array of the key/value pairs of an object Object.entries(object) // Creates an object from a list of keys/values Object.fromEntries() // Returns an array of the keys of an object Object.keys(object) // Returns an array of the property values of an object Object.values(object) // Groups object elements according to a function Object.groupBy(object, callback) |
The Object.assign() method copies properties from one or more source objects to a target object.
// Create Target Object const person1 = { firstName: “John”, lastName: “Doe”, age: 50, eyeColor: “blue” }; // Create Source Object const person2 = {firstName: “Anne”,lastName: “Smith”}; // Assign Source to Target Object.assign(person1, person2); |