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


Groups > comp.lang.javascript > #17973

Re: typeof and jslint

Message-ID <2177465.0Ca87JebjB@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Organization PointedEars Software (PES)
Date 2013-01-06 01:21 +0100
Subject Re: typeof and jslint
Newsgroups comp.lang.javascript
References <Ba2dnXXmp_MKKXXNnZ2dnUVZ_sydnZ2d@westnet.com.au>
Followup-To comp.lang.javascript

Followups directed to: comp.lang.javascript

Show all headers | View raw


Andrew Poulos wrote:

> If I test the following with jslint
>    if (typeof num === 'undefined') { return false; }
> 
> I get the error
>    Unexpected 'typeof'. Use '===' to compare directly with undefined.
> 
> I'm not sure what its telling me. Is it saying that I should instead use
>    if (num === undefined) { return false; }
> ?

Probably, yes.
 
> Why is tyepof unexpected?

Because Douglas Crockford has some rather weird and purely subjective 
notions how these languages – that he misleads others to think of as a 
single one – should be written, and those notions are expressed and
enforced by jslint.


PointedEars
-- 
var bugRiddenCrashPronePieceOfJunk = (
    navigator.userAgent.indexOf('MSIE 5') != -1
    && navigator.userAgent.indexOf('Mac') != -1
)  // Plone, register_function.js:16

Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

typeof and jslint Andrew Poulos <ap_prog@hotmail.com> - 2013-01-06 10:17 +1100
  Re: typeof and jslint Luc Yen <luc@goal.tw> - 2013-01-05 15:40 -0800
    Re: typeof and jslint Andrew Poulos <ap_prog@hotmail.com> - 2013-01-06 11:04 +1100
      Re: typeof and jslint Luc Yen <luc@goal.tw> - 2013-01-05 16:33 -0800
  Re: typeof and jslint David Mark <dmark.cinsoft@gmail.com> - 2013-01-05 16:16 -0800
    Re: typeof and jslint Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2013-01-11 00:53 +0100
  Re: typeof and jslint Stefan Weiss <krewecherl@gmail.com> - 2013-01-06 01:21 +0100
  Re: typeof and jslint Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-01-06 01:21 +0100

csiph-web