定义和用法:

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

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

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

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

语法:

array.map(function(currentValue,index,arr), thisValue)

参数说明:

JS中的map

 

 

实例:

var nums=[10,20,30];
    nums.map(function(value,index,arr){
        document.write('value值为:'+value); //10 20 30
        document.write('index值为:'+index); //0 1 2
        document.write('arr值为:'+arr); //[10,20,30]
    })

 

1
array.map(function(currentValue,index,arr), thisValue)

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-05
  • 2022-12-23
  • 2021-05-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案