+1 this is something even seasoned js developers routinely trip over.
-- Mikeal Rogers Sent with Sparrow (http://www.sparrowmailapp.com/?sig) On Tuesday, May 8, 2012 at 8:10 PM, Douglas Crockford wrote: > On 5/8/2012 2:45 PM, David Herman wrote: > > On May 8, 2012, at 9:19 AM, Rick Waldron wrote: > > > > > non-strict, non-opt-in: > > > > > > typeof null === "null"; // false > > > > > > implied opt-in: > > > > Changing typeof null always seemed questionable to me in terms of value. > > It doesn't really give you significant new functionality, it just kinda > > seems "more sensible". But adding it would just make things *more* > > messy, for very little gain. Since we can't eliminate the old typeof > > semantics, we end up with the language having different semantics in > > different contexts. > > > > > The issue isn't typeof null. null === is a more convenient test. The > issue is that typeof object gives a false positive when the value is > null. So sensing that a value is an object is error prone. We need a > simple, reliable test for objectness. > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss > >
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

