美文网首页
call和apply的区别

call和apply的区别

作者: 米诺zuo | 来源:发表于2018-06-19 23:25 被阅读5次
var  numbers = [5, 458 , 120 , -215 ]; 
var  maxInNumbers = Math.max.apply(this, numbers);  
console.log(maxInNumbers);  // 458
var maxInNumbers = Math.max.call(this,5, 458 , 120 , -215); 
console.log(maxInNumbers);  // 458

相关文章

网友评论

      本文标题:call和apply的区别

      本文链接:https://www.haomeiwen.com/subject/vgazeftx.html