15.2.3.3 Object.getOwnPropertyDescriptor(O, P)

2010-07-04

PD Object.getOwnPropertyDescriptor(O:object, P:string|mixed) throws TypeError

This function returns the Property Descriptor (PD) for given property as an object.

P will be coerced to a string.

Code: (Meta Ecma)
Object.getOwnPropertyDescriptor = function(O,P){
if (Type(O) != 'Object') throw TypeError;
var name = ToString(P);
var desc = O.[[GetOwnProperty]](name);
return desc;
}