JavaScript Minifier

Reduce whitespace in a simple JavaScript function while protecting its string literal.

Reduce whitespace in a simple JavaScript function while protecting its string literal.

How to use

  1. Load the greet example and note the trailing space inside the quotes.
  2. Minify the code and compare the return expression with the source.
  3. Test that calling the function still appends an exclamation mark and a space.

Worked example

Input

function greet(name) { return name + "! "; }

Expected result

function greet(name){return name+"! "}

Check the result

The output should show name+"! " with no extra spaces around +.

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