NumberStrings.js 是一个简单的 JavaScript 库,用来将数字转成更适合阅读的格式。
示例代码:
var ns = new NumberStrings();
console.log('1,000 = ' + ns.format(1000)); // outputs: "1,000 = 1 thousand"
console.log('50,000,000 = ' + ns.format(50000000)); // outputs: "50,000,000 = 50 million"
console.log('999,999,999 = ' + ns.format(999999999)); // outputs: "999,999,999 = 999.999999 million"