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
| // uglify -b | |
| function forgetVar() { | |
| myLongVariableName = 2; | |
| } | |
| function dontForgetVar() { | |
| var a = 2; | |
| } |
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
| // Original | |
| function forgetVar() { | |
| myLongVariableName = 2; | |
| } | |
| function dontForgetVar() { | |
| var myVeryVeryLongVariableName = 2; | |
| } |
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
| var a = function() { | |
| return document.getElementById.apply(document, arguments); | |
| }; |
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
| // Compression naïve et théorique | |
| var a = document.getElementById; | |
| var mine = a('mine'), | |
| his = a('mine'), | |
| hers = a('mine'); |
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
| // Version originale | |
| var mine = document.getElementById('mine'); | |
| var his = document.getElementById('his'); | |
| var hers = document.getElementById('hers'); |
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
| function logStyles() { | |
| var a = document.body.style; | |
| console.log(a.border, a.margin, a.padding); | |
| }; |
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
| function logStyles() { | |
| var doc_style = document.body.style; | |
| console.log(doc_style.border, | |
| doc_style.margin, | |
| doc_style.padding); | |
| } |
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
| function point() { | |
| function b(b) { | |
| a.position += b; | |
| } | |
| var a = {}; | |
| return a.position = 0, a.up = function() { | |
| a.move(10); | |
| }, a.down = function() { | |
| a.move(-10); | |
| }, a; |
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
| function point() { | |
| var p = {}; | |
| p.position = 0; | |
| function move (pixels) { | |
| p.position += pixels; | |
| }; | |
| p.up = function () { p.move(10); }; | |
| p.down = function () { p.move(-10); }; | |
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
| function point() { | |
| var a = {}; | |
| return a.position = 0, a.move = function(b) { | |
| a.position += b; | |
| }, a.up = function() { | |
| a.move(10); | |
| }, a.down = function() { | |
| a.move(-10); | |
| }, a; | |
| }; |