Many people will be familiar with this technique. Essentially, you take your JavaScript, remove some characters, and then simplify the variables. As demonstrated below:
Initial (66 characters)
- function Sum(number1, number2) {
- return (number1 + number 2);
- }
Characters removed (54 characters)
- function Sum(number1,number2){return
- number1+number2;}
Compacted (30 characters)
- function Sum(a,b){return a+b;}
You're left with less JS to download, and there's a hidden benefit: runtime performance. With tighter code and smaller variable names, the runtime can look up variables faster, improving download as well as runtime performance.
No comments:
Post a Comment
Note: only a member of this blog may post a comment.