☐ item
✔ item done
☐ use 'use strict';
☐ avoid pollution of the global namespace by using IIFE :
var myModule = (function($, undefined){
var myVar1 = '',
myVar2 = '';
var someFunction = function(){
return myVar1 + " " + myVar2;
};
return {
getMyVar1: function() { return myVar1; }, //myVar1 public getter
setMyVar1: function(val) { myVar1 = val; }, //myVar1 public setter
someFunction: someFunction //some function made public
}
})(jQuery);
☐ Never declare a function in a non-function block (if, while, etc)
☐ Assign variables at the top of their scope.