蔚蓝色的天,深蓝色的海,金黄色的沙,灰白色的鸥,穿着米白格子衬衫的你,站在金灿灿的阳光下,很耀眼。
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> </head> <body> </body> <script> // 数字转换 var numberFormat = function (value) { var param = {}; var k = 10000, sizes = ['', '万', '亿', '万亿'], i; if(value < k){ param.value =value param.unit='' }else{ i = Math.floor(Math.log(value) / Math.log(k)); param.value = ((value / Math.pow(k, i))).toFixed(2); param.unit = sizes[i]; } return param; } console.log(numberFormat(15222256.33)) </script> </html>
本文js将数值转化为万、亿、万亿并保留两位小数到此结束。欲望得不到满足痛苦;欲望一旦满足就无聊,生命就是在痛苦和无聊之间摇摆。小编再次感谢大家对我们的支持!