This JavaScript code example provides us two functions to clean up and format numbers quite nicely.
One JavaScript check number function will take any decimal number, negative or positive, and formats it by adding commas every three digits. The other JavaScript number format function can strip any non-numeric characters from a string leaving you with a valid decimal number. It also considers the minus sign and the period to be numeric and will not strip them unless the minus sign is not at the beginning of the number or there is more than one period.
These JavaScript functions make use of regular expressions to do the heavy lifting.
- Demo
- Enlarge
- Reload
- New window
Free iPage Web Hosting for First Year NOW
If you're still looking for a reliable web host provider with affordable rates, why you don't take a little of time to try iPage, only with $1.89/month, included $500+ Free Extra Credits for the payment of 24 months ($45)?
Over 1,000,000+ existisng customers can not be wrong, definitely you're not, too! More important, when you register the web hosting at iPage through our link, we're going to be happy for resending a full refund to you. That's awesome! You should try iPage web hosting for FREE now! And contact us for anything you need to know about iPage.
- Sent (0)
- New
Open tool hub for free to use by any one for every one with hundreds of tools
chatGPTaz
Voice chat comning soon. You could talk to ChatGPT and hear the most intelligent AI speaks very soon