Constructors need to be able to recognize uninitalized instances(?)

Axel Rauschmayer axel at rauschma.de
Sun Mar 17 17:38:16 PDT 2013


>     if ( this ===null || typeof this !== "object" ||  this[$fooBrand] !== false) /*CAAF*/
> 
> Then the last Or operand is true if either the instance has already been initialized or if `this` is an object that does not have a property whose key is $fooBrand (e.g. a namespace object). Interestingly, this expression is not the same as `! this[$fooBrand]`.

Sorry, correction:
`this[$fooBrand] !== false` is not the same as `this[$fooBrand]`. The former is true for `undefined`, the latter isn’t. The following is more intention-revealing:

    if ( this ===null || typeof this !== "object" ||  this[$fooBrand] === undefined || this[$fooBrand]) /*CAAF*/


-- 
Dr. Axel Rauschmayer
axel at rauschma.de

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130318/c4b0b5e9/attachment-0001.html>


More information about the es-discuss mailing list