码迷,mamicode.com
首页 > 编程语言 > 详细

把类似数组结构的数据转成数组的几种方式

时间:2017-02-15 16:13:06      阅读:153      评论:0      收藏:0      [点我收藏+]

标签:from   参数   map   call   es6   nts   ice   type   slice   

例如 : 将函数的 arguments参数转成数组格式 

es5:   

  [].slice.call(arguments)

  Array.prototype.slice.call(arguments)

 

es6:

  Array.from(arguments)      能将具有 Iterator接口的数据格式(Set, Map)转成真正的数组

  [...arguments]  也能将arguments转成数组

  

把类似数组结构的数据转成数组的几种方式

标签:from   参数   map   call   es6   nts   ice   type   slice   

原文地址:http://www.cnblogs.com/tangyuu/p/6401773.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!