Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] Force String to Float?
- From: peter at brunone.com (Peter Brunone)
- Subject: [Javascript] Force String to Float?
- Date: Tue May 15 11:12:58 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@xxxxxxxxxxxx> Sent: Tuesday, May 15, 2007 8:36 AM To: "\[JavaScript List\]" <javascript@xxxxxxxxxx> 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@xxxxxxxxxx https://lists.LaTech.edu/mailman/listinfo/javascript -------------- next part -------------- An HTML attachment was scrubbed... URL: https://lists.LaTech.edu/pipermail/javascript/attachments/20070515/7960d83c/attachment.html
- Follow-Ups:
- [Javascript] Force String to Float?
- From: Nick Fitzsimons
- [Javascript] Force String to Float?
- Prev by Date: [Javascript] Force String to Float?
- Next by Date: [Javascript] Force String to Float?
- Previous by thread: [Javascript] Force String to Float?
- Next by thread: [Javascript] Force String to Float?
- Index(es):