我查看了 tolocalestring() 并且它不起作用。
我试图让它:
- 1,000,000
- 10,000,000
- 等等...
这是我的代码:
$(document).ready(function() {
var number = parseInt($('#test').text(), 10) || 309320350
number.toLocaleString();
// Called the function in each second
var interval = setInterval(function() {
$('#test').text(number++); // Update the value in paragraph
}, 1000); // Run for each second
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<p id="test"></p>