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

JavaScript Array map() 方法

时间:2016-12-29 23:11:39      阅读:237      评论:0      收藏:0      [点我收藏+]

标签:blog   this   元素   数组元素   处理   java   index   pre   方法   

语法:

array.map(function(currentValue,index,arr), thisValue)
currentValue:必须。当前元素的值
index:可选。当期元素的索引值
arr:可选。当期元素属于的数组对象
thisValue:可选。对象作为该执行回调时使用,传递给函数,用作 "this" 的值。可改变this指向,

map() 方法返回一个新数组,数组中的元素为原始数组元素调用函数处理后的值。

map() 方法按照原始数组元素顺序依次处理元素。

注意: map() 不会对空数组进行检测。

注意: map() 不会改变原始数组。

JavaScript Array map() 方法

标签:blog   this   元素   数组元素   处理   java   index   pre   方法   

原文地址:http://www.cnblogs.com/98-bky/p/6234982.html

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