Skip to main content


Showing posts from 2017

Things you may not know about Javascript Objects

Object Properties:An Object is a non primitive data with collection of properties(key, value). Each property(key) of an Object has following configurable properties,
value - value of the property. Default: undefinedenumerable - if true, the property can be accessed using a loop and Object.keys. Default: falsewritable - if true, the property value can be modified. Default: falseget- defines a getter function. Default: undefinedset - defines a setter function. Default: undefinedconfigurable - if true, all the properties can be modified and deleted. Default: false With Object.defineProperty and Object.definePropertieswe can set the above configurable properties for an Object property(key).
With Object.getOwnPropertyDescriptor and Object.getOwnPropertyDescriptors we can get the above configurable properties associated with an Object property(key). example:var x = { a:1, b:2 }; Object.getOwnPropertyDescriptor(x, 'a'); // {value: 1, writable: true, enumerable: true, configurab…