Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #19841
| Message-ID | <15066019.Edmlg4qf5b@PointedEars.de> (permalink) |
|---|---|
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
| Organization | PointedEars Software (PES) |
| Date | 2013-05-20 14:23 +0200 |
| Subject | Re: jslint and typeof |
| Newsgroups | comp.lang.javascript |
| References | <kr2dnRlKLtGEaQTMnZ2dnUVZ_g6dnZ2d@westnet.com.au> <kncubd$i57$1@dont-email.me> <m2r4h16g1i.fsf@nntp.bednarz.nl> |
Eric Bednarz wrote: > "Jukka K. Korpela" <jkorpela@cs.tut.fi> writes: >> the test >> >> typeof options.actor !== "undefined" >> >> is unnecessary complicated, since you can use >> >> options.action !== undefined > > This, however, is unnecessarily brittle since the undefined property of > the global object is writable in ES < 5. ACK. And in earlier implementations there was no “undefined” property, causing this to throw (the equivalent of) a ReferenceError. > It is also overly verbose. In what way? > options.action !== void 0; I would call *that* overly verbose. For backwards compatibility, I have occasionally declared var undefined; However, nowadays the “!==” and “===” operators and the “undefined” property of the Global Object can generally be considered safe language features. Only a caveat with the property value and host objects must remain for the time being. -- PointedEars Twitter: @PointedEars2 Please do not Cc: me. / Bitte keine Kopien per E-Mail.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
jslint and typeof Andrew Poulos <ap_prog@hotmail.com> - 2013-05-20 19:59 +1000
Re: jslint and typeof "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2013-05-20 13:40 +0300
Re: jslint and typeof Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2013-05-20 13:34 +0200
Re: jslint and typeof Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-20 14:23 +0200
Re: jslint and typeof Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2013-05-26 17:40 +0200
Re: jslint and typeof Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-20 13:48 +0200
Re: jslint and typeof Stefan Weiss <krewecherl@gmail.com> - 2013-05-20 14:44 +0200
Re: jslint and typeof Andrew Poulos <ap_prog@hotmail.com> - 2013-05-20 23:17 +1000
csiph-web