Related to frustrations below

M

Matthew Crouch

As noted before, I'm not a JS programmer, but I ought to be able to get
a couple simple things done with it and now I've spent two weeks on them.

Main reasons:
- seems like JS is all-or-nothing. When I have a bug, the entire page is
blank.
- javascript console isn't outputting anything, so my current method of
finding bugs is to comment out every line in the script until i find the
one that makes the screen go blank. This was fun the first couple times,
but no longer.

So could anyone answer:
-what kind(s) of error make it so that JS won't compile. In my example
problem below this line:
options_total = +form.options_total.value;
results in a blank screen. as does
options_total = +document.form.options_total.value;
I find this surprising. If those ref's are no good, or the values are
blank, or not strings, I can fix that. But why would my whole interface
just not appear?

-Old versions of IE that I used would show an exclamation point in the
bottom-left, and you could read details on JS errors. This isn't
appearing. And in firefox, the Javascript Console isn't outputting
anything. Not even if I include the line:
I'm fat;

Really
 
M

Matthew Crouch

I was able to see some console output by setting
javascript.options.strict in about:config

what i see now are tons of warnings, mostly to do with undefined
variables, so I'm going to look in there...
What does "variable _____ hides argument" mean?
 
C

Christopher Benson-Manica

Matthew Crouch said:
- seems like JS is all-or-nothing. When I have a bug, the entire page is
blank.

More or less.
- javascript console isn't outputting anything, so my current method of
finding bugs is to comment out every line in the script until i find the
one that makes the screen go blank. This was fun the first couple times,
but no longer.

If you use a decent browser, you can use window.onerror to catch
most errors and get some information about what line the compiler
things the error occurred on. It isn't always helpful, but the times
that it is are sweet indeed.
I find this surprising. If those ref's are no good, or the values are
blank, or not strings, I can fix that. But why would my whole interface
just not appear?

Because you didn't catch the resulting exception; try/catch can also
improve your life dramatically, and they give you a chance to try to
recover from the error and go on semi-normally. If the exception
makes it up to the browser without being caught, your script execution
is basically done.
-Old versions of IE that I used would show an exclamation point in the
bottom-left, and you could read details on JS errors. This isn't
appearing. And in firefox, the Javascript Console isn't outputting
anything. Not even if I include the line:
I'm fat;

Firefox clearly is complimenting you on your svelte figure. That
aside, check to see that IE is configured to alert you to every script
error. I can't tell you why Firefox isn't displaying the console; I
actually have yet to have a need for it.
 
M

Michael Winter

I was able to see some console output by setting
javascript.options.strict in about:config

I've never used it, but a reliable source would suggest that some
warnings issued from the use of this option can be misleading at best,
and bogus at worst. Be careful.
what i see now are tons of warnings, mostly to do with undefined
variables, so I'm going to look in there...

It's generally considered a good idea to declare all variables
explicitly using the var statement, even though it's not necessary with
globals.
What does "variable _____ hides argument" mean?

I would have to guess that you've written something like:

function(myArgument) {
var myArgument;
}

However, if this is the case, then this is one of those bogus warnings
because the var statement above is effectively ignored; the argument
itself takes precedence.

The only way to 'hide' an argument is to create an inner function
declaration or assign to that argument. Both would replace its value,
but only the first (at most) would deserve notice.

Mike
 
C

Christopher Benson-Manica

Michael Winter said:
I've never used it, but a reliable source would suggest that some
warnings issued from the use of this option can be misleading at best,
and bogus at worst. Be careful.

Better or worse than jslint?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top