JS如何输出数字(每三位加逗号)
function toThousands(num) { var result = '', counter = 0; num = (num || 0).toString(); for (var i = num.length - 1; i >= 0; i--) { counter++; result = num.charAt(i) + result; console.log('charat res'+result); if (!(counter % 3) && i != 0) { result = ',' + result; } } return result; }
转自:https://blog.csdn.net/qq_37958260/article/details/80406851

浙公网安备 33010602011771号