Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Google Closure Compiler examples
- // Malformed JS
- var foo = {
- attrib1: 'foo',
- attrib2: 'bar', // <--- trailing comma
- }
- // RESULT:
- // [vincentc@local bad_js]$ gjs --js bad_js.js
- // bad_js.js:8: ERROR - Parse error. Internet Explorer has a non-standard intepretation of trailing commas. Arrays will have the wrong length and objects will not parse at all.
- // }
- //
- // 1 error(s), 0 warning(s)
- // Really wordy JS
- var bar = function () {
- // I am a really wordy js file
- // with many cool comments!
- console.log("I am a debug statement");
- x = 10;
- if (true) {
- x = 1 + 1;
- new Ajax.Updater('', {
- // We like to make tons of comments
- onSuccess: function () {
- $('cool_div').hide();
- },
- onComplete: function () {
- $('cool_div').show();
- }
- });
- }
- }
- // RESULT (notice: the if block has been removed since it always evals to true.
- // The '1+1' evaluation has just been replaced by 2):
- // [vincentc@local bad_js]$ gjs --js bad_js.js
- // var bar=function(){console.log("I am a debug statement");x=10;x=2;new Ajax.Updater("",{onSuccess:function(){$("cool_div").hide()},onComplete:function(){$("cool_div").show()}})};
Add Comment
Please, Sign In to add comment