84669 Lernen von Personen
152542 Lernen von Personen
20005 Lernen von Personen
5487 Lernen von Personen
7821 Lernen von Personen
359900 Lernen von Personen
3350 Lernen von Personen
180660 Lernen von Personen
48569 Lernen von Personen
18603 Lernen von Personen
40936 Lernen von Personen
1549 Lernen von Personen
1183 Lernen von Personen
32909 Lernen von Personen
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在那里只是占了个位置,