JS’s data descriptor and access descriptor are equivalent to two rules, only one rule can be selected?

  node.js, question

1: Set attribute descriptors, data descriptors or access descriptors for object attributes, only one of which will be enabled
2:
clipboard.png

clipboard.png

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:

clipboard.png

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:

clipboard.png