About javascript formatter
The formatter takes minified or messy JavaScript and lays it out with line breaks and indentation so you can read it.
What it cannot do
It does not restore original variable names. If the code was minified, names like a and b stay as they are. Use source maps for real debugging.
Safe to read, not to trust
Reading unfamiliar code is fine, but do not run scripts you do not understand.
A worked example
A minified line such as function a(b){return b>1?b*a(b-1):1} is laid out over several lines with indented blocks, so you can follow the recursion. Names such as a and b remain, because the original names were discarded when the code was minified.
Safe reading
- Read unknown code before you run it, especially anything that sends data or reads cookies.
- Use a source map with your browser's developer tools for real debugging.
- Format your own code with a tool such as Prettier in your project, so the team shares one style.
