Re: jslint doesn't like my syntax for conditional object creation
- From: "VK" <schools_ring@xxxxxxxxx>
- Date: 23 May 2006 03:11:37 -0700
VK wrote:
Or unless... briefly do not repeat my mistake and don't try
to restore 3rd party context by few errors. Wait until OP will post the
relevant code.
Richard Cornford wrote:
As if I would take your advice on anything.
And that's a shame because whoever doesn't take VK's advises is being
beat down publically (smile, joke, humor :-)
Go to <http://www.jslint.com/> and paste this single line of text to
validate:
if (Serious == null) {var Serious = {};}
You get these exact errors OP got:
Problem at line 1 character 16: Use '===' to compare with 'null'.
if (Serious == null) {var Serious = {};}
Problem at line 1 character 27: Var Serious was used before it was
declared.
if (Serious == null) {var Serious = {};}
Problem at line 1 character 27: Identifier 'Serious' already
declared as global
if (Serious == null) {var Serious = {};}
As I mentioned before, no one of them actually points to the real
problem (exception raised by addressing non-declared variable). JSLint
neuristic needs much more improvement on that.
The code you "restored" in your mind gives all different errors:
var Serious;
if (Serious == null) {var Serious = {};}
gives:
Problem at line 2 character 16: Use '===' to compare with 'null'.
if (Serious == null) {var Serious = {};}
Problem at line 2 character 27: Identifier 'Serious' already declared
as var*
if (Serious == null) {var Serious = {};}
That is a silly question. I know because I have spent some time
learning Javascript. I have also read and understood the source code
for JSLint and discussed the motivation for its error and warning
output with its author.
You may want to have more discussion with him after that (just don't
use the bat :-)
There is no such thing as a conditional variable declaration in javascript.
Eh?? No comments, really.
.
- Follow-Ups:
- Re: jslint doesn't like my syntax for conditional object creation
- From: Richard Cornford
- Re: jslint doesn't like my syntax for conditional object creation
- References:
- jslint doesn't like my syntax for conditional object creation
- From: petermichaux
- Re: jslint doesn't like my syntax for conditional object creation
- From: VK
- Re: jslint doesn't like my syntax for conditional object creation
- From: Richard Cornford
- Re: jslint doesn't like my syntax for conditional object creation
- From: VK
- Re: jslint doesn't like my syntax for conditional object creation
- From: Richard Cornford
- jslint doesn't like my syntax for conditional object creation
- Prev by Date: Re: jslint doesn't like my syntax for conditional object creation
- Next by Date: Re: jslint doesn't like my syntax for conditional object creation
- Previous by thread: Re: jslint doesn't like my syntax for conditional object creation
- Next by thread: Re: jslint doesn't like my syntax for conditional object creation
- Index(es):
Relevant Pages
|