;(function test($){
$.extend({
hello : function(a,b){console.log(a+"||"+b)}
});
})(jQuery);
//纯js封装
var my=my||{};
my.prorotype={
init:function(obj,i){
alert("hello");
},
hello:function(obj){
console.log("hello"+obj);
}
$.extend({
hello : function(a,b){console.log(a+"||"+b)}
});
})(jQuery);
//纯js封装
var my=my||{};
my.prorotype={
init:function(obj,i){
alert("hello");
},
hello:function(obj){
console.log("hello"+obj);
}
}
//匿名
var klm=klm ||{};
klm = (function(){
klm.init = function(){
};
})
本文介绍了一种使用JavaScript进行模块封装的方法,包括利用jQuery扩展方法、自定义命名空间及原型对象的方式实现模块化编程。

被折叠的 条评论
为什么被折叠?



