15.2.3.6 Object.defineProperty(O, P, Attributes)

2010-07-04

object Object.defineProperty(O, P:string|mixed, Attributes:object) throws TypeError

Add or update own property of O.

P is coerced to a string and is the name of the property.

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