【Object.defineProperty】
1、The Object.defineProperty()
method defines a new property directly on an object, or modifies an existing property on an object, and returns the object.
2、Normal property addition through assignment creates properties which show up during property enumeration (for...in
loop or Object.keys
method), whose values may be changed, and which may be deleted. This method allows these extra details to be changed from their defaults. By default, values added usingObject.defineProperty()
are immutable.
3、Property descriptors present in objects come in two main flavors: data descriptors and accessor descriptors. A data descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property described by a getter-setter pair of functions. A descriptor must be one of these two flavors; it cannot be both.
3、configurable
4、enumerable
5、writable