function dealFloatData(num){ let formatNum = num.toFixed(2).replace(/\B(?=(\d{3})+\b)/g, ",").replace(/^/, "$$ "); console.log(formatNum) } dealFloatData(1123.123)