D
Dr J R Stockton
In comp.lang.javascript message <609f1ed2-0820-4676-ba2b-505d2ab4d8b6@s5
0g2000hsb.googlegroups.com>, Tue, 19 Aug 2008 15:30:35,
(e-mail address removed) posted:
When claiming that something does not work, state which versions of
which browsers you are using, and what if anything their debug
facilities gave you. If you mean that it gave a "wrong" answer, say
what the data and the "incorrect" and hoped-for answers were. If it
gave an error message, say what that was.
For a helpful demonstration, include code to set i j fpssArray[j] and
m to known values, and state what you expect and what you actually get.
Use copy'n'paste to ensure faithfulness. When coding, omit superfluous
parentheses and indent in two-space units to show the intended logical
structure. My js-quick.htm will give a first approximation to rational
indentation.
And give your real name and whereabouts when posting, unless you want to
make people think that you are ashamed of your work. And follow other
traditional Usenet conventions too - see sig.
Re your original line
tempx = parseInt(parseFloat(((fpssArray[j]).toString()).
substring((m*3),(m*3)+3)) + .9);
One should never use a decimal point without at least one digit on each
side. When reading it, the computer will read it reliably; a human may
not.
Whatever that line is meant to do (assuming toString() is needed), it
does seem to convert a Number to a Number. That can more effectively be
done by purely numeric operations. parseInt should not be used instead
of Math.floor or |0. To convert a decimal digit string to a Number,
unary + is most effective.
0g2000hsb.googlegroups.com>, Tue, 19 Aug 2008 15:30:35,
(e-mail address removed) posted:
Again, THE real problem IS (and I had forgotten) is that THIS,
tempx = parseInt(((fpssArray[j]).toString()).substring((m*3),
(m*3)+3));
does NOT work.
When claiming that something does not work, state which versions of
which browsers you are using, and what if anything their debug
facilities gave you. If you mean that it gave a "wrong" answer, say
what the data and the "incorrect" and hoped-for answers were. If it
gave an error message, say what that was.
For a helpful demonstration, include code to set i j fpssArray[j] and
m to known values, and state what you expect and what you actually get.
Use copy'n'paste to ensure faithfulness. When coding, omit superfluous
parentheses and indent in two-space units to show the intended logical
structure. My js-quick.htm will give a first approximation to rational
indentation.
And give your real name and whereabouts when posting, unless you want to
make people think that you are ashamed of your work. And follow other
traditional Usenet conventions too - see sig.
Re your original line
tempx = parseInt(parseFloat(((fpssArray[j]).toString()).
substring((m*3),(m*3)+3)) + .9);
One should never use a decimal point without at least one digit on each
side. When reading it, the computer will read it reliably; a human may
not.
Whatever that line is meant to do (assuming toString() is needed), it
does seem to convert a Number to a Number. That can more effectively be
done by purely numeric operations. parseInt should not be used instead
of Math.floor or |0. To convert a decimal digit string to a Number,
unary + is most effective.