Number to (KMB) Kilo, Million and Billion

kilo, million, billion, numbers, and, commas  Jul 15, 2022

This script will loop through all elements having class="addKMB"

It will perform below operations on each number

  1. KMB the number
  2. It will round to 2 decimal places the number after KMB
  3. It will add commas after each 3 digits from right
the element with class addKMB should have number only with (dot and comma allowed only) no currency sign or anythings else.
SNo Number Output
1 123.2343223 123.2343223
2 4,574.666 4,574.666
3 2342.324234 2342.324234
4 434234 434234
5 2342344.23423 2342344.23423
6 435345555.34534 435345555.34534
7 4535345345.1653 4535345345.1653
8 345353545435.85 345353545435.85
9 3.4534534534535E+14 3.4534534534535E+14
10 34534534534554534 34534534534554534
11 3453345345 3453345345
12 3.4534534534535E+19 3.4534534534535E+19