JavaScript格式化工具
为压缩后的JavaScript添加缩进,并在分号和花括号处换行。
如何使用本工具
- 1
Paste or type your JavaScript into the input textarea.
- 2
Watch the indented version appear live in the output box below as you type — there is no Format button.
- 3
Select the formatted text in the output box and copy it with your keyboard (there is no copy button).
- 4
Scan the result for any line that split inside a string, regex, or comment, and fix those by hand if needed.
什么是JavaScript格式化工具?
压缩后的代码包会移除所有空白:便于快速分发,却让人难以阅读。这个基础格式化工具会恢复缩进,并在分号和花括号处断行。如需保留注释、遵循ASI规则的生产级重新格式化,请使用Prettier或你编辑器内置的格式化工具。
常见使用场景
Eyeballing a minified vendor bundle or one-line snippet to see its rough structure before debugging.
Quickly indenting a short config or object literal you pasted from a chat message or log line.
Spreading a dense JSON-like object across multiple lines so nesting becomes visible.
Teaching or demoing how braces and semicolons map to indentation levels for beginners.
Making a compressed third-party script readable enough to locate a specific function or variable.
Sanity-checking that brackets are balanced, since unbalanced input leaves the indentation visibly skewed.
常见问题
它和Prettier一样好吗?▼
相关工具
JWT解码器
即时解码JSON Web Token(JWT)。完全在你的浏览器中运行:令牌绝不会离开你的设备,可安全用于生产环境的密钥。
JSON格式化与校验工具
在线格式化、校验和压缩JSON。完全在你的浏览器中运行:你的数据永远不会离开你的设备。
XML格式化工具
格式化并美化XML文档。适用于SOAP、站点地图、RSS订阅源和配置文件。
Base64编码与解码工具
将字符串编码为Base64,或将Base64解码为文本。尊重你的隐私:全部在你的浏览器中运行。
URL编码与解码工具
将文本转换为URL安全的编码(百分号编码),或进行反向转换。适用于查询字符串、重定向和OAuth流程。
HTML实体编码与解码工具
将特殊字符转换为HTML实体(&、<等),或进行反向转换。适用于将文本安全地嵌入HTML。