Skip to main content

Posts

Showing posts from January, 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: undefined enumerable - if true, the property can be accessed using a for..in loop and Object.keys . Default: false writable - if true, the property value can be modified. Default: false get   - defines a getter function. Default: undefined set - defines a setter function . Default: undefined configurable - if true, all the properties can be modified and deleted. Default: false With  Object.defineProperty  and  Object.defineProperties   we 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 = {