let num = 12345678.002345
let start = (num + '').split('.')[0].split('').reverse()
let end = (num + '').split('.')[1]
let s = '',cur = '',n = start.length
for(let i=0;i<n;i++){
let res = start.shift()
cur += res
if(cur.length === 3){
s+= cur
if(start.length !== 0){
s+=','
}
cur = ''
}
}
s+=cur
start = s.split('').reverse().join('')
console.log(start+'.'+end)
// 12,345,678.002345