Google Closure Compiler Advanced Compilation - Live Demo

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:

The page may freeze for a couple of seconds, while the compiler is doing is job...

An example from Google blog

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);
        

An example that shows how smart is the compiler


            function foo(x) {
            if(x > 19) {
            return x * 100;
            }
            return x * 10000;
            }

            console.log([foo(2), foo(111), foo(window.y)]);