This site has been acquired by Toptal.com.

JavaScript Minifier

Online JavaScript Minifier/Compressor. Provides an API. Simple and Fast.

Perl

Thanks to Boris Kotyrev (I've adapted what he sent to be more minimal).

use strict;
use warnings;

use File::Slurp;
use HTTP::Request::Common qw(POST);
use LWP::UserAgent;

sub minify{
    my ($js) = @_;

    my $js_min_url = "https://www.toptal.com/developers/javascript-minifier/raw";

    my $ua = LWP::UserAgent->new;
    my $request = POST($js_min_url, [ 'input' => $js ]);
    my $js_min = $ua->request($request)->decoded_content();

    return $js_min;
}

print minify($js, "\n");

Click on the language of your choice to see an example: