Prev: JSon vs XML speed
Next: should I use document.write()?
From: FAQ server on 31 Mar 2010 19:00 ----------------------------------------------------------------------- FAQ Topic - Why does K = parseInt('09') set K to 0? ----------------------------------------------------------------------- Method ` parseInt ` generally needs a second parameter, ` radix `, for the base (value between 2 and 36). If ` radix ` is omitted, the base is determined by the contents of the string. Any string beginning with ` '0x' ` or ` '0X' ` represents a hexadecimal number. A string beginning with a leading ` 0 ` may be parsed as octal (octal digits are ` 0-7 `). The string ` '09' ` is converted to ` 0 `. To force use of a particular base, use the ` radix ` parameter: ` parseInt("09", base) `. http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Functions/parseInt http://msdn.microsoft.com/en-us/library/x53yedee%28VS.85%29.aspx http://docs.sun.com/source/816-6408-10/toplev.htm#1064173 http://jibbering.com/faq/faq_notes/faq_notes.html#FAQN4_12 The complete comp.lang.javascript FAQ is at http://jibbering.com/faq/ -- The sendings of these daily posts are proficiently hosted by http://www.pair.com.
From: Dr J R Stockton on 2 Apr 2010 17:09 In comp.lang.javascript message <4bb3d3fa$0$282$14726298(a)news.sunsite.dk >, Wed, 31 Mar 2010 23:00:03, FAQ server <javascript(a)dotinternet.be> posted: > >If ` radix ` is omitted, the base is determined by the contents of >the string. Any string beginning with ` '0x' ` or ` '0X' ` represents a >hexadecimal number. A string beginning with a leading ` 0 ` may be >parsed as octal (octal digits are ` 0-7 `). The string ` '09' ` >is converted to ` 0 `. Incomplete - needs mention of leading whitespaces and sign. Leading tab and newline are accepted in FF 3.0.19. This was discussed before. -- (c) John Stockton, nr London UK. ?@merlyn.demon.co.uk Turnpike v6.05 MIME. Web <URL:http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links. Proper <= 4-line sig. separator as above, a line exactly "-- " (RFCs 5536/7) Do not Mail News to me. Before a reply, quote with ">" or "> " (RFCs 5536/7)
|
Pages: 1 Prev: JSon vs XML speed Next: should I use document.write()? |