How to Use the JavaScript Formatter Basic: Steps and a Worked Example
Add line breaks after semicolons and braces in minified JavaScript. This guide shows what to enter, a worked example, and the limits to keep in mind. The JavaScript Formatter Basic tool is free, needs no account and runs in your browser.
What you need
- JavaScript
Step by step
- Open the JavaScript Formatter Basic tool.
- Fill in JavaScript.
- Read the result, which updates as soon as the inputs change.
Worked example
the tool returns:
function add(a,b){
return a+b;
}const total=add(1,2);
console.log(total);
How it works
Paste JavaScript. This basic formatter splits statements onto lines; it does not parse the code, so strings containing ; or braces are split too.
Things to keep in mind
Check your inputs, units and any local rules before you rely on the result.
Related tools
If this is not quite what you need, try SQL Formatter Basic, JSON Formatter or CSS Formatter.