JS中map()函数的使用
一、概念map()方法定义在JavaScript的Array中,它返回一个新的数组,数组中的元素为原始数组调用函数处理后的值。注意:map()不会对空数组进行检测map()不会改变原始数组二、语法array.map(function(currentValue, index, arr), thisIndex)参数说明:function(currentValue, index, arr):必须。为一个函数,数组中的每个元素都会执行这个函数。其中函数参数:currentValue:必须。当前元素的的值。index:可选。当前元素的索引。arr:可选。当前元素属于的数组对象。thisValue:可选