let a = '123456.235'a = Number(a).toFixed(2).toString().replace(/(\d{1,3})(?=(\d{3})+(?:$|\.))/g, "$1,")console.log(a,typeof(a),'1111111111') //123,456.24 string 1111111111
1500字范文,内容丰富有趣,写作好帮手!
时间:2021-10-24 13:20:50
let a = '123456.235'a = Number(a).toFixed(2).toString().replace(/(\d{1,3})(?=(\d{3})+(?:$|\.))/g, "$1,")console.log(a,typeof(a),'1111111111') //123,456.24 string 1111111111