Хабр Курсы для всех
РЕКЛАМА
Практикум, Хекслет, SkyPro, авторские курсы — собрали всех и попросили скидки. Осталось выбрать!


function hello(name) {
var code = 19;
var srt = 'dss';
alert('Hello, ' + name);
}
hello('New user');
function hello(a){alert("Hello, "+a)}hello("New user");
The ADVANCED_OPTIMIZATIONS level goes beyond simple shortening of variable names in several ways, including:
* more aggressive renaming:
Compilation with SIMPLE_OPTIMIZATIONS only renames the note parameters of the displayNoteTitle() and unusedFunction() functions, because these are the only variables in the script that are local to a function. ADVANCED_OPTIMIZATIONS also renames the global variable flowerNote.
*dead code removal:
Compilation with ADVANCED_OPTIMIZATIONS removes the function unusedFunction() entirely, because it is never called in the code.
* function inlining:
Compilation with ADVANCED_OPTIMIZATIONS replaces the call to displayNoteTitle() with the single alert() that composes the function's body. This replacement of a function call with the function's body is known as «inlining». If the function were longer or more complicated, inlining it might change the behavior of the code, but the Closure Compiler determines that in this case inlining is safe and saves space. Compilation with ADVANCED_OPTIMIZATIONS also inlines constants and some variables when it determines that it can do so safely.
if (document.getElementById('comment_content_'+idFeedback)) {
document.getElementById('comment_content_'+idFeedback).innerHTML='комментарий был удален';
}
if(document.getElementById("comment_content_"+idFeedback))document.getElementById("comment_content_"+idFeedback).innerHTML='\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439 \u0431\u044b\u043b \u0443\u0434\u0430\u043b\u0435\u043d';
api_version: 1
source_dir: src
output_dir: js
default_compilation_level: simple
targets:
output_filename-1.js:
compilation_level: advanced
sources:
- input-1.1.js
- input-1.2.js
- input-1.3.js
output_filename-2.js:
sources:
- input-2.1.js
- input-2.2.js
Оптимизация Javascript с помощью Google Closure Compiler