How to use JavaScript Formatter
Format JavaScript with Prettier, a syntax-aware formatter that produces consistent indentation and line breaks.
- Paste JavaScript into the source editor.
- Select Format code.
- Review and copy the formatted output.
Example
Input
const a={x:1,y:2}
Result
const a = { x: 1, y: 2 };
Important to know
Formatting changes presentation, not program intent. Invalid JavaScript produces a parser error.