Phương thức Number.prototype.toLocaleString() định dạng số thành chuỗi theo quy ước locale (phân cách hàng nghìn, dấu thập phân...).
Ví dụ
<html>
<head>
<title>JavaScript toLocaleString() Method</title>
</head>
<body>
<script>
var num = new Number(150.1234);
document.write(num.toLocaleString()); // "150.123" hoặc "150,123" tùy locale
</script>
</body>
</html>