84669 personnes étudient
152542 personnes étudient
20005 personnes étudient
5487 personnes étudient
7821 personnes étudient
359900 personnes étudient
3350 personnes étudient
180660 personnes étudient
48569 personnes étudient
18603 personnes étudient
40936 personnes étudient
1549 personnes étudient
1183 personnes étudient
32909 personnes étudient
a=[10,20,30] alert(Math.max(10,20,30)) alert(Math.max.apply(null,a))
可以理解这里为什么要用apply,是为了让math.max可以处理数组,但是不能理解Null是什么意思?
学习是最好的投资!
看看snandy的解释:http://www.cnblogs.com/snandy...
表示把null传给函数中的this。因为max是不用this的,这里方便起见就传个null。
null
this
max
这里不需要 this,所以随便传什么都无所谓
null在那里只是占了个位置,
Math.max.apply(a,a) 30 Math.max.apply(999,a) 30 a [10, 20, 30]
看看snandy的解释:http://www.cnblogs.com/snandy...
表示把
null
传给函数中的this
。因为max
是不用this
的,这里方便起见就传个null
。这里不需要
this
,所以随便传什么都无所谓null在那里只是占了个位置,