JavaScript格式化器
在浏览器中处理或呈现JavaScript格式化。
LOCAL JAVASCRIPT FORMATTING
Make JavaScript easier to read
Format source text in your browser. The page never evaluates or uploads the code.
Up to 100,000 characters. Input is treated as text only.
Review the text before using it in a project.
Limits: 100,000 input characters. Formatting is text-only and does not parse, import, evaluate, or execute JavaScript.
使用步骤
如何使用
- Paste JavaScript up to 100,000 characters.
- Choose two or four spaces, then format the source.
- Review the formatted text and copy or download it.
Token-aware formatting
Strings, template literals, regular expressions, comments, and escaped characters are kept intact while punctuation and braces receive consistent spacing and indentation.
Local and bounded
Formatting happens entirely in your browser. Input is limited to 100,000 characters and the page treats the source as text, so it never imports, evaluates, or executes your code.
常见问题
你可能还想知道
Does this run my JavaScript?
No. The page only scans source text and produces formatted text locally.
Are strings and comments preserved?
Yes. Quoted strings, template literals, regular expression literals, line comments, and block comments are kept as tokens.
Does this validate JavaScript?
It provides formatting help but is not a full parser or linter. Review the output in your normal development tools.
Can I format TypeScript?
The token formatter works best with JavaScript-like syntax, but it does not type-check or transform TypeScript.