* 将一个数组分成几个同等长度的数组
* array[分割的原数组]
* size[每个子数组的长度]
*/function sliceArray(array, size) {
var result = []
for (var x = 0 x < Math.ceil(array.length / size) x++) {
var start = x * size
var end = start + size
result.push(array.slice(start, end))
}
return result
}
function number(source){source = String(source).split(".")
source[0] = source[0].replace(new RegExp('(\\d)(?=(\\d{3})+$)','ig'),"$1,")
return source.join(".")
}
测试 :alert(number(123456.22))