javascript 内部属性[[Class]]

Posted by bower on September 22, 2011
javascript

分享给你的朋友->bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

jvascript object 内部属性, 每一个对象都有这些内部属性

Internal Property Value Type Domain Description
[[Prototype]] Object or Null The prototype of this object.
[[Class]] String A String value indicating a specification defined classification of objects.
[[Extensible]] Boolean If true, own properties may be added to the object.
[[Get]] SpecOp(propertyName) →
any
Returns the value of the named property.
[[GetOwnProperty]] SpecOp (propertyName) → Undefined orProperty Descriptor Returns the Property Descriptor of the named own property of this object, orundefined if absent.
[[GetProperty]] SpecOp (propertyName) → Undefined or Property Descriptor Returns the fully populated Property Descriptor of the named property of this object, or undefined if absent.
[[Put]] SpecOp (propertyName, any, Boolean) Sets the specified named property to the value of the second parameter. The flag controls failure handling.
[[CanPut]] SpecOp (propertyName) → Boolean Returns a Boolean value indicating whether a [[Put]] operation withpropertyName can be performed.
[[HasProperty]] SpecOp (propertyName → Boolean) Returns a Boolean value indicating whether the object already has a property with the given name.
[[Delete]] SpecOp (propertyName, Boolean) → Boolean Removes the specified named own property from the object. The flag controls failure handling.
[[DefaultValue]] SpecOp (Hint) → primitive Hint is a String. Returns a default value for the object.
[[DefineOwnProperty]] SpecOp (propertyName, PropertyDescriptor, Boolean) → Boolean Creates or alters the named own property to have the state described by a Property Descriptor. The flag controls failure handling.

 

he value of the [[Class]] internal property is defined by this specification for every kind of built-in object. The value of the [[Class]] internal property of a host object may be any String value except one of "Arguments", "Array", "Boolean", "Date", "Error", "Function", "JSON", "Math", "Number", "Object", "RegExp", and "String". The value of a [[Class]] internal property is used internally to distinguish different kinds of objects. Note that this specification does not provide any means for a program to access that value except through Object.prototype.toString

 

class这个属性是用来识别对象类别的比如”Arguments”, “Array”, “Boolean”, “Date”, 而且这个属性不可写, 也不可直接读, 只能通过 Object.prototype.toString()来得到。

 

 

分享到:人人网开心网腾讯微博新浪微博豆瓣分享腾讯空间百度搜藏腾讯书签

分享给你的朋友->bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

1 Comment to javascript 内部属性[[Class]]

Leave a Reply

Your email address will not be published. Required fields are marked *

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word