var my = function (name,fn){
alert(name);
(fn&&typeof(fn)==="function")&&fn(name);
};
var mycallback = function(name){
alert("回调"+name);
}
my('张三',mycallback);
$(function(){
$.extend({
min:function(a,b){
return a>b?b:a;
},
max:function(a,b){
return a>b?a:b;
}
});
console.info($.max(1,2));
console.info($.min(1,2));
$.fn.extend({
red:function(){
return $(this).css('color', '#ff0000');
}
});
var obj1 = {
name:"张三",
age:18
}
var obj2 = {
name:"李四",
age:18,
sex:"男",
add:function(){
console.info("添加");
}
}
var obj3 = $.extend({},obj1,obj2);
obj3.add();
console.info(JSON.stringify(obj1));
console.info(JSON.stringify(obj3));
});