Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #19841

Re: jslint and typeof

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!newsfeed.fsmpi.rwth-aachen.de!uucp.gnuu.de!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail
Content-Type text/plain; charset="UTF-8"
Message-ID <15066019.Edmlg4qf5b@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Reply-To Thomas 'PointedEars' Lahn <usenet@PointedEars.de>
Organization PointedEars Software (PES)
Date Mon, 20 May 2013 14:23:47 +0200
User-Agent KNode/4.10.2
Content-Transfer-Encoding 8Bit
X-Face %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&.<b';Md8`dH6iqhT)6C^.Px|[=M@7=Ik[_w<%n1Up"LPQNu2m8|L!/3iby{-]A+#YE}Kl{Cw$\U!kD%K}\2jz"QQP6Uqr],./"?;=4v
Face iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/TmpY5VFefuVcAkkPbLIaN8rmPmjloyZxgyR3GuJ4K0AGtJ2htz8o7yqikm759fldQXaMpbDzjKAG+8v+AugVTOPO5DOjLvGtUYQwh0CPjnVMyGd+8/GfUB5nLKJDD2aLDh5HYyMDJGDwQIo2ZmZcKbowNmAdB/AzyFhrmF2MHRb0QJJfaAnwGB6orZhoykLzJtGwF/xpYxI1dswomiUj3gTuAIqCn/4C7cULwGNBtwMTk3Y4LfKB5YUaOKBKYtpplm7u0vip8tU1NWWyI/7XdcSuIDoMt6rVHMWT0DbjHPGqDqZVSa6zleLcUTcIKLoMv3ueJluALtAo9B302zPPlrtiVScRdCjXvVh3e3JpYa/jjkuC9N+LrBMlz/eAN4eQijX2EdLo6c5tGGHwLyHFtXk89dDGHwCVhG9T0S/j55AhRZgkMCmUQXJ49TnS1wnQDvw0eAh9ICeMmEFbCnPMFzjAvsWoEWEFdYEx+S0MoUZ1gT1wId8+AF3Bl2OoEu906AUHx5VLw/gXYg/x84loOah/2UYNrgiwSwGO7RfUzVBbx/kgpckumGOi6QirtD6gkLTitbnxNol47S2jVc2vsN5kPqaAHT8uUdAJM4v/DanjYOwmUjWznGfwB7sGtAtor5BgofDuzaRj4kSQAqDakTsKORa3Q3xKi3gE1fhl71KRMqrdZ2AWNNg/YOhQyrVBnb+i+nEg4bsDA+egAAAABJRU5ErkJggg==
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>
MIME-Version 1.0
Lines 38
NNTP-Posting-Date 20 May 2013 14:25:31 CEST
NNTP-Posting-Host fa89d066.newsspool2.arcor-online.net
X-Trace DXC=fML_D=68cP`PXlQ;h]GTMdA9EHlD;3Ycb4Fo<]lROoRa8kF<OcfhCOk4LhWYJTITMlDZm8W4\YJNlb@mF9jNikde7a5\<`>]gfnPm07ZT5g5Al
X-Complaints-To usenet-abuse@arcor.de
Xref csiph.com comp.lang.javascript:19841

Show key headers only | View raw


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


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