jQuery.fn = jQuery.prototype = {
init: function( selector, context ) {
//……
};
$.fn.extend()扩展方法添加到$('#app‘)实例对象
$.extend() 扩展方法添加到jquery类本身
比如:
$.fn.extend({
min: function(a,b){
if(a>b){
console.log(b)
}else{
console.log(b)
}
}
})
$.extend({
add: function(a,b){
console.log(a+b);
return a + b;
}
})
$('#app').min(4,6)
$.add(4,5);