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
- Load the greet example and note the trailing space inside the quotes.
- Minify the code and compare the return expression with the source.
- 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 +.