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


Groups > comp.lang.javascript > #17974

Re: typeof and jslint

Newsgroups comp.lang.javascript
Date 2013-01-05 16:33 -0800
References <Ba2dnXXmp_MKKXXNnZ2dnUVZ_sydnZ2d@westnet.com.au> <90b3cbc7-939c-44a3-8412-bc1f3630167f@googlegroups.com> <O-adnQikndziInXNnZ2dnUVZ_vOdnZ2d@westnet.com.au>
Message-ID <73eb3b7a-9d14-4d89-9ffb-8e504d75fb83@googlegroups.com> (permalink)
Subject Re: typeof and jslint
From Luc Yen <luc@goal.tw>

Show all headers | View raw


Andrew Poulos於 2013年1月6日星期日UTC+8上午8時04分01秒寫道:
> On 6/01/2013 10:40 AM, Luc Yen wrote:
> 
> > Andrew Poulos於 2013年1月6日星期日UTC+8上午7時17分29秒寫道:
> 
> >> 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.
> 
> > [...]
> 
> >> Why is tyepof unexpected?
> 
> >
> 
> > $ jslint --browser filename.js
> 
> 
> 
> Is that an answer to my questions? If it is, I don't understand it.
> 
> 
> 
> Andrew Poulos
jslint enforces it's coding style. The following snippet is ok.
The typeof line is identical to the original code.
-----
var num;
function test() {
    "use strict";
    if (typeof num === 'undefined') {
        return false;
    }
}

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next 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