function Person(name,age){
this.name=name;
this.age=age;
}
function Father(name,age){
Person.call(this,name,age) //Person.apply(this,arguments)
}
var son=new Father('zhang','11')
call (this, 参数 1,参数2)
apply (this,arguments)
this 指向 调用构造函数的对象
------------------------------------------------数组合并----------------------------
var arr1=new Array("1","2","3",6,4,55,55);
var arr2=new Array("4","5","6");
Array.prototype.push.apply(arr1,arr2);
---------------------------------------------求最大值
var max=Math.max.apply(null,[1,2,2,43,4,3,23,23,43,5,2,4,5,45,4,3,3,34,3,4,3,5,3,43])
console.log(max)
网友评论