Google Closure Compiler Ajax Demo
This is a demo of the javascript minifier/compiler from
Google Closure Compiler
.
Type JavaScript code to optimize here:
/*! * This is an important comment * Date: 27-27 */ /* This is a block comment that would need to be removed */ var _var1=123; var _var2='abc'; const _CONST1=1234; const _CONST2=9876; let _let1=123; let _let2=987; // This is a line-comment that needs to be removed // and this is something else function getElemInfo(elem) { var localvar1=123; var localvar2=345; let locallet1='abc'; let locallet2='def'; const localconst3=true; const localconst4=false; var test=locallet2.replace(/'/, 'abc'); //if ( elem==undefined ) msg=''; // '
'; var c=99; // and / and // and // if ( elem==false ) { return 'NULL'; } if ( elem==window ) { return 'window'; } let a='xxxxx
button
';console.log(a); var newTx=''; if ( elem.tagName ) { newTx=newTx+' tag='+elem.tagName; } if ( elem.id ) { newTx=newTx+' id='+elem.id; } if ( elem.className ) { newTx=newTx+' class='+elem.className; } if ( localconst3 ) console.log('localconst3=true'); else console.log('localconst3=false'); if ( 1==2 ) console.log('1==2'); else { console.log(`1<>2`); } doSomething('Lorem Ipsum // Delor */'); // doSomething(\"Lorem \\\"Ipsum\\\" // Delor */\"); let myPet = 'seahorse'; console.log('My favorite animal is the \${myPet};.'); return newTx; }
WHITESPACE_ONLY
SIMPLE_OPTIMIZATIONS
ADVANCED_OPTIMIZATIONS
Clipboard