`
pstinghua
  • 浏览: 24379 次
  • 性别: Icon_minigender_1
  • 来自: 北京
最近访客 更多访客>>
社区版块
存档分类
最新评论

The constructor Property

阅读更多
[size=medium]Since constructor functions define new categories or classes of objects, the constructor property can help
determine the type of an object. For example, you might use code like the following to determine the type
of an unknown value:
if ((typeof o == "object") && (o.constructor == Date))
     // Then do something with the Date object...

The instanceof operator checks the value of the constructor property, so the code above could also be
written:
if ((typeof o == "object") && (o instanceof Date))
     // Then do something with the Date object...

[/size]
分享到:
评论

相关推荐

    setter-on-constructor-prototype.rar_The Next

    在描述中提到的"Get the name of the next property of Result(3) that doesn't have the DontEnum attribute",指的是查找Result(3)对象中下一个没有DontEnum属性的属性名。DontEnum是JavaScript中的一个特性,它...

    FlexGraphics_V_1.79_D4-XE10.2_Downloadly.ir

    Initialized with DefaultLinkPointSize constant in the TFlexPanel constructor. - FIX: The TFlexPanel.DoNotify method now virtual. - ADD: Added property class TBackgroundOptionsProp. Used in ...

    NETCFSERUP

    <param name="s">A string that contains the name of the property.</param> - (System.String,System.Boolean)"> <summary>PropertyNameAttribute constructor with settable name and optional flag....

    javascript.the.definitive.guide.5th.2006(英文版)

    It documents every class, object, constructor, method, function, property, and constant defined by JavaScript 1.5 and ECMAScript version 3. Part IV is a reference for client-side JavaScript, ...

    ape_a0452d物理引擎

    Group now takes collideInternal setting as a parameter in the constructor. Fixed a bug where certain particles/constraints would be drawn before their parent hierarchy was added to the engine ...

    不常用的TParser类解析(文本文件中相关字符串)

    constructor Create(); Creates a new parser instance. destructor Destroy; override; Destroys the parser instance. procedure CheckToken(); Checks whether the token if of the given type. procedure ...

    Visual_Studio_Package.vsix

    The biggest problem with the Microsoft default code generator is that the generated constructor is protected, which means that it can’t be used to construct strongly-typed resources in Visual Studio...

    Java邮件开发Fundamentals of the JavaMail API

    Fundamentals of the JavaMail API Presented by developerWorks, your source for great tutorials ibm.com/developerWorks Table of Contents If you're viewing this document online, you can click ...

    TPerlRegEx〖D7~XE5〗

    Some of the property and method names in the original TPerlRegEx were a bit unwieldy. These have been renamed in the latest TPerlRegEx. Essentially, in all identifiers SubExpression was replaced with ...

    Google C++ Style Guide(Google C++编程规范)高清PDF

    (One exception is if an argument Foo or const Foo& has a non-explicit, one-argument constructor, in which case we need the full definition to support automatic type conversion.) We can declare ...

    C#读取JPEG图片的Exif信息

    /// This is default constructor of the EXIF class. /// public EXIF() { } /// /// This is base constructor of the EXIF class. /// public EXIF(string filePath) { _picture = Image.From...

    JavaScript权威指南(第五版).chm

    It documents every class, object, constructor, method, function, property, and constant defined by JavaScript 1.5 and ECMAScript version 3. Part IV is a reference for client-side JavaScript, ...

    VirtualTreeView V5.5.2

    * Partial fix for issue #478: The standard VCL property StyleElemets (public in TControl in RAD Studio XE3 and higher) is now supported and published for TVirtualStringTree and TVirtualDrawTree (XE3 ...

    Effective Java 3rd edition(Effective Java第三版英文原版)附第二版

    Item 3: Enforce the singleton property with a private constructor or an enum type Item 4: Enforce noninstantiability with a private constructor Item 5: Prefer dependency injection to hardwiring ...

    Prototype Cheat Sheet

    - **`getStyle(element, property)`**: Retrieves the computed style of an element for a specific property. - **`getWidth(element)`**: Retrieves the width of an element. - **`hasClassName(element, ...

    weapp.qrcode.js

    // Not own constructor property must be Object if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) { return false; } // Own properties are enumerated firstly, so to speed up, // if...

    effective Java(第3版)各章节的中英文学习参考(已完成).zip

    请考虑构建器)Item 3: Enforce the singleton property with a private constructor or an enum type(使用私有构造函数或枚举类型实施单例属性)第 4 条使用私有构造函数强制不可实例化(用初始化构造函数实施不可...

    Springjava.pdf

    -- setter injection using the nested <ref/> element --> <property name="helloservice"><ref bean="helloService"/></property> <!-- 可以不设置类型--> <property name="name" value="yoo"></property> ```...

    nrComm

    Restriction~~~~~~~~~~~~~~ There are exists two version of nrComm Lib: = With Nag screen when constructor call and with the limited of data receive. (Free available in ...

    NativeXml-master

    * constructor CreateParentNear instead of CreateParentBefore/After to avoid clash with CppBuilder + added zlib compression and AES encryption for BXM in the demo Version 3.32 (07jul2011) ! re-added ...

Global site tag (gtag.js) - Google Analytics