js 中数字与字符串之间的转换

数字转换为字符串

var num  = 123;

1.num.toString

2."" + num

3.String(num)

将数字转化为格式化后的字符串

num.toFixed(2)   小数点后显示两位

toExponential() 科学计数法

toPrecision() 精确位数

 转自:https://www.cnblogs.com/anqiang1995/p/10034558.html
 
原文地址:https://www.cnblogs.com/javalinux/p/15633737.html