Array.prototype.slice.call(arguments)能够将具有length属性的对象转化为数组,

可以理解为将arguments转化成一个数组对象,让它具有slice方法

如:

function test(){
console.log(Array.prototype.slice.call(arguments));
}
test(1,2);

Array是一个类,不能直接引用,需要获取原型后才能使用。

如果要直接引用,需要实例化array

var array = new Array();

array.slice.call(arguments);

array.slice(start,end)

console.log([1,2,3].slice());
//[1, 2, 3]
console.log([1,2,3].slice(1,3));
//[2, 3]

call的作用是改变this的指向,相当于arguments调用了slice这方法

最新文章

  1. 大话JS面向对象之开篇万物皆对象------(ATM取款机引发的深思)
  2. JS常用的function集合
  3. 【struts2】Result和ResultType
  4. Big Data, MapReduce, Hadoop, and Spark with Python
  5. Android项目实战(七):Dialog主题Activity实现自定义对话框效果
  6. TCP/IP 小知识
  7. 在js中使用createElement创建HTML对象和元素
  8. Careercup - Google面试题 - 5732809947742208
  9. Contest1065 - 第四届“图灵杯”NEUQ-ACM程序设计竞赛(个人赛)E粉丝与分割平面
  10. 【MyBatis】 通过包含的jdbcType类型
  11. The Hundred Greatest Theorems
  12. 谁占用了我的Buffer Pool
  13. Docker最全教程之使用 Visual Studio Code玩转Docker(二十)
  14. - Fractal(3.4.1)
  15. Laravel创建产品-CRUD之Create and Store
  16. Maximum Swap LT670
  17. sqlmap工作流程图
  18. SeqGAN 原理简述
  19. mac 必备工具
  20. c#解析Lrc歌词文件

热门文章

  1. 将Matlab中的矩阵输出到txt文件
  2. 转:ibatis的cacheModel
  3. JavaScript 实现彩票中随机数组的获取
  4. 浅谈iOS触摸事件理解
  5. 【iCore3 双核心板_FPGA】实验二十五:NIOS II之UART串口通信实验
  6. hihoCoder 1184 连通性二·边的双连通分量
  7. OpenGL函数思考-glLoadIdentity
  8. Struts2与Ajax的整合
  9. Scala的函数,高阶函数,隐式转换
  10. iOS 因为reason: 'Pushing the same view controller instance more than once is not supported而奔溃(下)