代码示例:var n=12343434
(1)toLocalString()
n.toLocalString()即可。
(2)正则
(n+ '').replace(/(\d{1,3})(?=(\d{3})+(?:$|\.))/g,'$1,')
看的似懂非懂,正则任重而道远,以后还是多看吧:https://www.runoob.com/regexp/regexp-metachar.html
(3)算法
数字和字符串相互转换链接://www.greatytc.com/writer#/notebooks/40531328/notes/61196744