question archive What are the two categories of properties in JavaScript?
Subject:Computer SciencePrice:2.89 Bought3
What are the two categories of properties in JavaScript?
3 property descriptors
a property descriptor encodes the tributes of a propery as an object.each of the properties of that object corresponds to an attribute.
example read only property
whose value is 123:
{
value:123,
writable:false,
enumerable:true,
configurable:false
}
3.1 functions that use property descriptor
Object.defineproperty(obj,propName,propDesc)
create or changes a property on object whose name is propname and whose attributes are specified via propdesc.
var obj=object.defineprop
value:123,
enumerable:true
//writable and configu
});