Put the amount number in the formatted form?

1. The amount number is sent from the backend

price:"1111.00"  //

2, realization effect

3, my own implementation ideas

make the number + into an array and add items with insufficient tables (empty characters), and cycle through the page

implementation is a bit low, is there a good implementation scheme

4, address demonstration

http://jsrun.net/YbXKp/edit

Jul.05,2022

string blanks can be filled using the padStart method of String .

  

there is still bug. It would be wrong if the data is changed to 1111.0 to show the amount. I think it is still divided into decimal and integer parts, with two decimal places in length, which is not enough to complement 0

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1be7486-31852.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1be7486-31852.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?