Last active
August 29, 2015 14:10
-
-
Save H2CO3/ff70d3c5e88d600b6b7a to your computer and use it in GitHub Desktop.
I just read in the description of Google's Closure compiler that it "compiles JavaScript to better JavaScript".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is how H2CO3 writes a JavaScript to better JavaScript compiler | |
function compile(source) { | |
return ""; // no JavaScript is definitely better than some JavaScript | |
} | |
// Usage example | |
var exampleSource = "window.alert('foo');"; | |
eval(compile(exampleSource)); // extra advantage: no more annoying alert windows! |
I'm glad I could help. Hopefully examining the generated code improved your JavaScript skills as well!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This helped me understand compiler design. Now I don't have to take a course or buy a book.