Object.assign()

The object.assign () method is used to assign the value of an enumerable property from one or more source objects to a target Object, which it returns

let obj = {a: 111.b:222.c: 333};
let obj1 = {d: 444.e: 555};
Object.assign(obj, obj1)
// {a: 111, b: 222, c: 333, d: 444, e: 555}If an attribute in the target object has the same key, the attribute is overwritten by an attribute in the source objectCopy the code

Object.create()

The object.create () method creates a new Object, using an existing Object to provide the newly created Object’s __proto__ argument: the prototype Object of the newly created Object This method can be used to implement class inheritance

Literal and`new`The object created by the keyword is`Object`The prototype points to`Object.prototype`, inherits the built-in objects`Object`
`Object.create`The prototype of the object created depends on the object instance passed in if`null`The new object is an empty object. It has no prototype and does not inherit from any object. Otherwise, the prototype of the new object points to the specified object and inherits from the specified objectCopy the code

Object.defineProperty()

The object.defineProperty () method directly defines a new property on an Object, or modifies an Object’s existing property. Data descriptors and access descriptors cannot be mixed

Object.definePropertys

The object.definepropertys () method can directly define new properties or modify existing properties on an Object, the difference being that you can modify more than one property at a time

Object.entries()

The object.entries () method returns an array of key-value pairs for the given Object’s own enumerable properties

const object1 = {
  a: 'somestring'.b: 42
};

for (const [key, value] of Object.entries(object1)) {
  console.log(`${key}: ${value}`);
}

Copy the code

Object.fromEntries()

The object.fromentries () method converts the list of key-value pairs into an Object that is the opposite of Object.entries()

const entries = new Map([['foo'.'bar'],
  ['baz'.42]]);const obj = Object.fromEntries(entries);
console.log(obj);
// { foo: "bar", baz: 42 }
Copy the code

Object.hasOwnProperty()

The object.hasownProperty () method returns a Boolean indicating whether the Object has a specified key in its own key; Unlike the IN operator, the modification method ignores attributes inherited from the stereotype chain

let obj = {name: 11};
obj.hasOwnProperty('name');
// true
Copy the code

Object.is()

The object.is () method determines whether two values are the same

Object.isExtensible()

The object.isextensible () method determines whether an Object isExtensible and returns Boolean

Object.isFrozen()

The object.isfrozen () method determines whether an Object isFrozen and returns Boolean

Object.prototype.isPrototypeOf()

Object. The prototype. IsPrototypeOf () method is used to test whether an Object exists in the prototype chain of another Object

Object.keys()

Object.values()