Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
var num =2.446242342;
//四舍五入
num = num.toFixed(6); // 输出结果为 2.446242
//转数字
var str = "123"
var num = Number(str); //num为数字123
Reference:
Link: JS into digital method