call()与apply() 的区别 以及Math.max和Math.min
function Student(name){
this.name=name
this.showInfo=function(){
console.log(this.name)
}
this.abc=function(a,b,c){
console.log(a,b,c)
console.log(this.name)
}
}
var s1=new Student("王一")
var s2=new Student("王二")
s1.showInfo()
s2.showInfo()
//call(对象,参数)方法 可以用于改变this的指向
//参数1:替换对象1中this
//参数2-n:方法对应的参数
s1.abc.call(s2,2,3,4)
//console.log(s1.abc())
//.apply(替换的对象,参数数组) 可以用于改变this的指向
//参数1:替换的对象
//参数2:参数数组
s1.showInfo.apply(s2,null)
s1.abc.apply(s2,[1,2,3])
//Math.max,Math.min
var arr=[1,2,3,4,5]
var max=Math.max.apply(null,arr)
var min=Math.min.apply(null,arr)
console.log(max)
console.log(min)