Namespace your JavaScript function and variable with jQuery
We all know that global variable are evil. Namespacing your variables and methods is now considered a good practice and shows your awareness about the trends. Anyway, I thought how can I namespace my variables and methods in jQuery. Well, first off, I can easily extend jQuery with custom written plugins. $.fn.extend({
myNamespaced: function(myArg){
return 'namespaced.' + myArg;
}
});
myNamespaced: function(myArg){
return 'namespaced.' + myArg;
}
});
Comments
Post a Comment