问题描述:

I'm trying to have my numbers in a format that is easier for the user to read.

Eg. Instead of: 12349568483, it would be: 12 349 568 483.

I was wondering if there is a simple way to do this?

网友答案:
var a = "12349568483";
a = a.split('').reverse().join('').replace(/([0-9]{3})/g, "$1 ").split('').reverse().join('');
相关阅读:
Top