摘要: var a = function(a,b){ console.log(a+b);},b = { c:5, d:3};a.call(b,1,2);a.apply(b,[1,2]);a.call(b,b.c,b.d);a.call(b,this.c,this.d); 阅读全文
posted @ 2015-03-14 15:24 唸随爱 阅读(126) 评论(0) 推荐(0) 编辑
摘要: var a = [2,3,4,5],c = Math.max.apply(null,a);console.log(c);console.log(Math.max.apply(null,[3,8,44,48]));console.log(Math.max.call(null,3,8,44,48));当... 阅读全文
posted @ 2015-03-14 15:14 唸随爱 阅读(170) 评论(0) 推荐(0) 编辑
摘要: var ary = [8,9,10,3], compare = function(a,b){ return b.age-a.age; }, g = [ { name:"jim", age:29 }, { name:"tom", age:15 ... 阅读全文
posted @ 2015-03-14 14:51 唸随爱 阅读(111) 评论(0) 推荐(0) 编辑
摘要: function a(){ console.log(arguments.length); var c = [].slice.call(arguments);//类数组转成数组 c.push(5); console.log(c); console.log(arguments);}a(1,2,3)var... 阅读全文
posted @ 2015-03-14 14:49 唸随爱 阅读(523) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2015-03-14 11:28 唸随爱 阅读(203) 评论(0) 推荐(0) 编辑