1: Set attribute descriptors, data descriptors or access descriptors for object attributes, only one of which will be enabled
3: get method has no effect.
JS can only select one rule for data descriptor and access descriptor.
ToPropertyDescriptorThe specification definition section is as follows:
If either desc.[[Get]] or desc.[[Set]] is present, then
If either desc.[[Value]] or desc.[[Writable]] is present, throw a TypeError exception.
The above description indicates that if both descriptors are defined when using the defineProperty method, an error will be reported. the test screenshot is as follows:
In addition, it is also possible to redefine an attribute with one descriptor and then another, except that descriptors that are not common to the two descriptors will be reset to their default values.
ValidateAndApplyPropertyDescriptorThe specification definition section is as follows:
The test screenshots are as follows: