javascript之array

array 

1.map

  看mdn的时候发觉 map不一定需要这样用:arr.map(function(x){return 2*x})

还可以这样:

Array.prototype.map.call("1234",function(x){return x})  //["1","2","3","4"]

这种结果也就是字符串转数组的str.split("")一毛一样!

为什么map可以这样!它的实现机制究竟是什么样的?

posted @ 2015-11-18 20:15  belongcai  阅读(159)  评论(0编辑  收藏  举报