Minified function
- JavaScript code
- function add(a,b){return a+b}
- Indent
- 2 spaces
Result Formatted code: function add(a, b) {
return a + b
}
Lines: 3
Tokens: 13
Comments: 0
Deepest nesting: 1
Characters in: 29
Characters out: 37
- Split the code into 13 tokens; strings, template literals, regex literals and comments are copied unchanged.
- Opened a new line after each { and ; and between object properties, indenting 2 spaces per level (deepest level: 1).
- Put one space around binary operators and after commas, and none inside ( ) or [ ], giving 3 lines.
The body moves onto its own indented line, and spaces appear after the comma and around the plus sign.