Google Closure Compiler has been ported to javascript.
As a consequence, it is now possible to advanced compile javascript code in the browser!
The code snippets are live and interactive, powered by the KLIPSE plugin:
Ctrl-Enter
to evaluate (or wait for 5 seconds).
The page may freeze for a couple of seconds, while the compiler is doing is job...
This example is take from https://developers.google.com/closure/compiler/docs/api-tutorial3.
function unusedFunction(note) {
alert(note['text']);
}
function displayNoteTitle(note) {
alert(note['title']);
}
var flowerNote = {};
flowerNote['title'] = "Flowers";
displayNoteTitle(flowerNote);
function foo(x) {
if(x > 19) {
return x * 100;
}
return x * 10000;
}
console.log([foo(2), foo(111), foo(window.y)]);