标签:
String.prototype.strReverse = function() { return this.split(‘‘).reverse().join(‘‘); } function amountSplit(amount) { return amount.toString().strReverse().replace( /(\d+\.)?(\d{1,3})/g, ‘$1$2,‘ ).strReverse().substring( 1 ); } console.log( amountSplit( 120000.12 ) ); // 120,000.12 console.log( amountSplit( 1285000) ); // 1,285,000
Math.round(num1 / num2 * 10000) / 100.00 + ‘%‘
标签:
原文地址:http://www.cnblogs.com/happyfreelife/p/4248455.html