On 22/09/2011, at 11:07 PM, Anders Jönsson wrote:

> Ah, of course.
> 
> But why do we need both "'localStorage' in window" and
> "window['localStorage'] !== null; "?


`localStorage in window` 
        => checks if "localStorage" is specified in window object

`window.localStorage !== null` 
        => checks to make sure that "localStorage" is not a null object (i.e., 
typeof null === 'object')




I don't think we need both. IMHO the following should suffice:

`!!window.localStorage`


null and undefined are both _falsy_, so I don't see why the above shouldn't 
work.



/davidhong 
(@hongymagic)



-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/jsmentors@jsmentors.com/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/jsmentors@googlegroups.com/

To unsubscribe from this group, send email to
jsmentors+unsubscr...@googlegroups.com

Reply via email to