# JavaScript 如何格式化数字

URL: https://caijiao.org/how-to/javascript/number-format
Source: docs/how-to/javascript/number-format.md
Description: JavaScript 如何格式化数字：用 Intl.NumberFormat 处理千分位、货币和本地化格式。 示例可直接复制到浏览器或项目代码中，并附相关教程、工具入口。

## 快速答案

用 Intl.NumberFormat 处理千分位、货币和本地化格式。

```js
const text = new Intl.NumberFormat('zh-CN').format(1234567.89);
```

## 使用要点

- 先确认输入单位、时区和本地化格式，尤其是秒级时间戳与毫秒级时间戳。
- 展示给用户的文本可以本地化，存储和接口传输仍建议使用明确格式。

## 相关内容

- [JavaScript / TypeScript 问题](/how-to/javascript/)
- [JavaScript 教程](/javascript/)
- [TypeScript 教程](/ts/)
- [JSON Formatter](/tool/json-formatter)
- [JSON Validator](/tool/json-validator)
