2.4.3.1 Object.getOwnPropertyDescriptor (O, P)

This function is not defined for JScript 5.7. It exists only in JScript 5.8.

  1. When the getOwnProperty function is called, the following steps are taken:

2. If the Type(O) is not Object, raise a TypeError exception.

3. If the O is not a host object that supports property access using this function, raise a TypeError exception.

4. Let name be ToString(P)

5. If O does not have an own property named name, return a new object created as if by evaluating the ECMAScript expressions: {configurable:true,enumerable: true,value: undefined, writable: true}

6. Let desc be a new object created as by evaluating the expression { }.

7. If the own property named name of O has the DontEnum attribute, let flag be true; if it does not have the DontEnum attribute, let flag be false.

8. Call the [[Put]] method of desc passing "enumerable" and flag as arguments.

9. If the own property named name of O has the DontDelete attribute, let flag be false; if it does not, have the DontEnum attribute let flag be true.

10. Call the [[Put]] method of desc passing "configurable" and flag as arguments.

11. If the own property named name of O is an accessor property, go to step 16.

12. Let value be the current value of the own property named name of O.

13. Call the [[Put]] method of desc passing "value" and value as arguments.

14. If the own property named name of O has the ReadOnly attribute, let flag be false; if it does not have the ReadOnly attribute, let flag be true.

15. Call the [[Put]] method of desc passing "writable" and flag as arguments.

16. Return desc.

17. If the own accessor property named name of O has a defined get function, let func be that function object; otherwise, let func be undefined.

18. Call the [[Put]] method of desc passing "get" and func as arguments.

19. If the own accessor property named name of O has a defined set function, let func be that function object; otherwise, let func be undefined.

20. Call the [[Put]] method of desc passing "set" and func as arguments.

21. Return desc.

Show: