[Javascript] Force String to Float?

Peter Brunone peter at brunone.com
Tue May 15 11:12:13 CDT 2007


I know that parseInt has a default number base of 8, so you want to specify that second parameter -- e.g. parseInt(myNum, 10) -- to make sure numbers get parsed correctly...  maybe the same thing is true of parseFloat...?

----------------------------------------

From: tedd <tedd at sperling.com>
Sent: Tuesday, May 15, 2007 8:36 AM
To: "\[JavaScript List\]" <javascript at LaTech.edu>
Subject: Re: [Javascript] Force String to Float? 

At 7:35 AM -0500 5/15/07, Triche Osborne wrote:
>tedd wrote:
>>At 2:30 AM +0100 5/15/07, Matt Warden wrote:
>>>On 5/15/07, tedd wrote:
>>>>So, how do I force a string to a float?
>>>
>>>parseFloat(...)
>>
>>
>>I tried that, but found it problematic.
>>
>
>Problematic? How so? It's core JS. What sort of problem have you 
>encountered with it?
>
>Triche

Well... it was problematic for me in trying to convert a string into 
a float. I'm sure it was my mistake -- I'm dyslexic. Taking a string 
* 1 seems much more straightforward and easier for me to comprehend. 
But, I'll try it again.

Thanks,

tedd
-- 
-------
http://sperling.com http://ancientstones.com http://earthstones.com
_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20070515/7960d83c/attachment.htm>


More information about the Javascript mailing list