mcUIControls - mcFormatNumber

The mcFormatNumber function is part of mcUITools.js - the purpose of this page is to test it.


When producing graphs, I wanted a way to add a comma to the tick labels. Since this is fairly complicated, and since javascript does not have a format command (method), I created this function.

For entered numbers, the default conversion is pretty good .. until the result of some division produces 8 (or more) digits of precision - then it is a disaster!

In addition, I strongly dislike software that produces some result and you simply have to accept it.

In use, the user can select the formatting type and number of digits.


The code


Author: Robert Clemenzi
URL: http:// mc-computing.com / Languages / Javascript / mcUIControls / test / mcFormatNumber.html