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

  1. Copy the greet example, including the space after ! inside the quoted string.
  2. Run the formatter and review the line breaks and indentation.
  3. 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.

Continue with another guide

Cookie
We care about your data and would love to use cookies to improve your experience.

Learn how we use cookies