FAQ Topic - Why does parseInt('09') give an error?

D

Dr John Stockton

JRS: In article <[email protected]>, dated
Thu, 14 Sep 2006 02:03:43 remote, seen in
Randy Webb said:
It should also promote the best practice and not specifying the Radix is
a recipe for disaster for 99% of the people who would be looking that up
in the FAQ.

Control freak. 99% != 100%.

In helping the multitude, it is wrong to mislead the intelligent
minority.
 
R

Randy Webb

Dr John Stockton said the following on 9/14/2006 4:58 PM:
JRS: In article <[email protected]>, dated
Thu, 14 Sep 2006 02:03:43 remote, seen in

Control freak.

You are bordering on becoming idiotic.
99% != 100%.

<sarcasm>
You don't say? I am glad you let me know, otherwise the world might have
thought differently.
In helping the multitude, it is wrong to mislead the intelligent
minority.

The "intelligent minority" fall into the people who can master parseInt
in under 10 minutes and wouldn't be looking in the FAQ anymore. And I am
willing to wager that the 1% that I left out would include it anyway.

As I said, if you want to continue believing the garbage you are
spouting about how it could be advisable to leave it, then please live
in that fantasy world as that is all it is. I will simply repeat what I
said in the last post:

<quote>
If you want to give people the advice to try to feature detect how to
deal with Base 8, then please do. I will reply back with how ignorant
that idea is. Same for Base 10 and Base 16. There is a very simple
solution to it:

Always use the Radix and it will never matter.
</quote>

I did notice you didn't give me a potential scenario example to back up
your claim of:

<quote>
In the wider world there are applications in which it would be
appropriate to allow the user to choose between decimal and hexadecimal
directly, without auxiliary controls.
</quote>

It is trivial to give the user the option of choosing the base and to
write code to try to determine what the user wanted instead of using
"auxiliary controls" is another recipe for disaster. But, live your
fantasy John.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?
 
D

Dr John Stockton

JRS: In article <[email protected]>, dated Thu,
24 Aug 2006 23:00:01 remote, seen in FAQ
server said:
-----------------------------------------------------------------------
FAQ Topic - Why does parseInt('09') give an error?
-----------------------------------------------------------------------

The parseInt function decides what base the number is by looking
at the number. By convention it assumes that any number beginning
with 0x is Hexadecimal, and otherwise any number beginning with
0 is Octal. To force use of base 10 add a second parameter
`` parseInt("09",10) ''

http://msdn.microsoft.com/library/en-us/script56/html/js56jsmthparseint.asp

http://docs.sun.com/source/816-6408-10/toplev.htm#1064173

http://www.jibbering.com/faq/faq_notes/faq_notes.html#FAQN4_12


While not actually matching the current FAQ topic line (change it to
"How and when should parseInt be used"), ISTM useful to add an
illustration such as
P = parseInt(b.offsetParent.offsetWidth)
where IIRC the format is decimal followed by 'px'.
 
R

Randy Webb

Dr John Stockton said the following on 9/15/2006 5:46 PM:
JRS: In article <[email protected]>, dated
Fri, 15 Sep 2006 02:24:44 remote, seen in

As you so often do : doubling the value adds nothing.

You're an idiot. If it weren't for the misleading arguments you use to
further advance your own agenda you wouldn't be worth replying to.
 

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

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top