JavaScript Beautifier
Expand a compact function so its argument and return value are easy to review.
Expand a compact function so its argument and return value are easy to review.
How to use
- Copy the greet example, including the space after ! inside the quoted string.
- Run the formatter and review the line breaks and indentation.
- Read the return line and compare the quoted literal with the input.
Worked example
Input
function greet(name){return name+"! "}Expected result
function greet(name) {
return name + "! "
}Check the result
The return statement should be indented and the string must still contain ! followed by a space.