Hosting Solutions
mobile_logo Table of Contents


The create() method of the Object object creates a new object associated to a specified prototype.

SyntaxObject.create( object_prototype, properties_object )


object_prototype The prototype object. properties_object (optional) This parameter can be given the following optional properties: configurable - [boolean] Descriptor can be changed and property can be deleted. Default value is 'false'. enumerable - [boolean] Can be traversed or counted. Default value is 'false'. value - Value for the property which can be any data type you choose. writable - [boolean] Property may be changed. Default value is 'false'. get - getter function for the property. The return value will be used as the value of property. set - setter function for the property. The argument given is the new value being assigned to the property.


var obj = { property1: "abc", property2: "xyz" } var instance = Object.create( obj ); alert( instance.property2 ); var obj = Object.create( Object.prototype, { property1: { value: 'abc', writable: false }, property2: { value: 'xyz', writable: true } }); alert(obj.property1);