Re: FAQ Topic - Why does parseInt('09') give an error?
JRS: In article <4vidnYgEf_cWZW bZnZ2dnUVZ_q-dnZ2d@comcast.c om>, dated
Mon, 4 Sep 2006 05:58:44 remote, seen in news:comp.lang. javascript,
Randy Webb <HikksNotAtHome @aol.composted :
But you would enforce a base, rather than allowing a choice.
>
>Your imagination amuses me sometimes. If that were true, then there
>would be *NO* need for any kind of data validation at all.
The existence of at least one case where data validation is not needed
does not disprove the existence of cases where data validation is
appropriate. You've been following Logic 101 again, and that is known
to be buggy.
With two, three, or even as many as four characters, how would you, as a
mere coder, allow the user to choose whether he wants to enter data in
decimal or hexadecimal?
>>
>It is rare that all bases are equally likely, in my experience.
>
>You are the one that brought up 2-36, not me. But that is your typical
>style is to avoid your mistakes.
To include the possibility of bases 2 to 36 is by no means to say that
all are equally likely. When did you last use decimal? When did you
last use base 29?
You, the coder, cannot know the preference of the user in all cases.
That forces base 16, as you should know. It does not allow the user to
choose between decimal and hexadecimal. But parseInt(inputV alue) does
that.
>
>Aside from your grammatical errors, you don't say?
Now we see that you do not understand the difference between a
grammatical error and a minor typo.
>
>If there were anything in your signature worth studying then I might.
Without studying it, how could you possibly know? - except for the line
corresponding to one in your own signature.
It's a good idea to read the newsgroup and its FAQ.
--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.c om/faq/>? JL/RC: FAQ of news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links.
JRS: In article <4vidnYgEf_cWZW bZnZ2dnUVZ_q-dnZ2d@comcast.c om>, dated
Mon, 4 Sep 2006 05:58:44 remote, seen in news:comp.lang. javascript,
Randy Webb <HikksNotAtHome @aol.composted :
>Dr John Stockton said the following on 9/2/2006 5:15 PM:
>JRS: In article <K9udnWZ_xYY8aW XZnZ2dnUVZ_oedn Z2d@comcast.com >, dated
>Fri, 1 Sep 2006 23:04:09 remote, seen in news:comp.lang. javascript,
>Randy Webb <HikksNotAtHome @aol.composted :
>Fri, 1 Sep 2006 23:04:09 remote, seen in news:comp.lang. javascript,
>Randy Webb <HikksNotAtHome @aol.composted :
>>>There are circumstances in which it is right for the user to
>>>choose the base from 8, 10, 16.
>>There is a need to *always* choose the base for 8 and 10.
>>>choose the base from 8, 10, 16.
>>There is a need to *always* choose the base for 8 and 10.
>Having been given an instruction that Hex can be written as 0xfff and
>octal as 0777 otherwise decimal, anyone entering "09" deserves whatever
>they get.
>octal as 0777 otherwise decimal, anyone entering "09" deserves whatever
>they get.
>Your imagination amuses me sometimes. If that were true, then there
>would be *NO* need for any kind of data validation at all.
does not disprove the existence of cases where data validation is
appropriate. You've been following Logic 101 again, and that is known
to be buggy.
>With you, you can never tell what needs to be repeated and what doesn't.
>
>
>Are you kidding me? Write a lot of code to detect how parseInt works
>when you can add 2, maybe 3, characters and have no problems at all?
>That isn't "feature detection", that is ignorance based on writing code
>(in your words here) "by the yard".
>
>Perhaps you have never heard of something called "feature detection"?
>Are you kidding me? Write a lot of code to detect how parseInt works
>when you can add 2, maybe 3, characters and have no problems at all?
>That isn't "feature detection", that is ignorance based on writing code
>(in your words here) "by the yard".
mere coder, allow the user to choose whether he wants to enter data in
decimal or hexadecimal?
>>That limits your statement to Base 16.
>>Which means that the *only* time you can *reliably* omit the Radix is
>>Base 16. And assuming that you are only dealing with Base 2-36 that is
>>1/35 times that it is reliable.
>>Which means that the *only* time you can *reliably* omit the Radix is
>>Base 16. And assuming that you are only dealing with Base 2-36 that is
>>1/35 times that it is reliable.
>It is rare that all bases are equally likely, in my experience.
>You are the one that brought up 2-36, not me. But that is your typical
>style is to avoid your mistakes.
all are equally likely. When did you last use decimal? When did you
last use base 29?
>Provide the Radix and it is *NEVER* an issue.
>OK, just for you, let me give you an example that just might satisfy
>your pedantics.
>
>Assume that your data is coming from a user entered field:
>
>var inputValue = document.someFo rm.someInput.va lue;
>
>Where the user enters the data.
>
>parseInt(input Value,16);
>
>Now, will *THAT* satisfy your pedantic stupid arguments?
>your pedantics.
>
>Assume that your data is coming from a user entered field:
>
>var inputValue = document.someFo rm.someInput.va lue;
>
>Where the user enters the data.
>
>parseInt(input Value,16);
>
>Now, will *THAT* satisfy your pedantic stupid arguments?
choose between decimal and hexadecimal. But parseInt(inputV alue) does
that.
>But if the average user of the page wishes to choose between Decimal and
>Hexadecimal. he will not be able to do so by choosing the second
>parameter in that simple fashion. He would need, say, radio-buttons or
>another field to choose the base.
>Hexadecimal. he will not be able to do so by choosing the second
>parameter in that simple fashion. He would need, say, radio-buttons or
>another field to choose the base.
>Aside from your grammatical errors, you don't say?
grammatical error and a minor typo.
>I trust that you will study the sig of this message.
>If there were anything in your signature worth studying then I might.
corresponding to one in your own signature.
It's a good idea to read the newsgroup and its FAQ.
--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.c om/faq/>? JL/RC: FAQ of news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links.
Comment