如何返回当前数字的字符串值版本?
的toLocaleString()方法中可以根据浏览器的本地设置变化的格式返回当前号码的字符串值的版本。
示例
您可以尝试运行以下代码以返回字符串值版本-
<html>
<head>
<title>JavaScript toLocaleString() Method </title>
</head>
<body>
<script>
var num = new Number(150.1234);
document.write( num.toLocaleString());
</script>
</body>
</html>