zoukankan      html  css  js  c++  java
  • JS中的map

    定义和用法:

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

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

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

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

    语法:

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

    参数说明:

    实例:

    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)
  • 相关阅读:
    Linux Netcat命令
    clang-format
    keytool
    ip
    Linux iptables
    Linux yum源完全配置
    Makefile
    CMake
    HSTS
    开源镜像
  • 原文地址:https://www.cnblogs.com/mica/p/11776876.html
Copyright © 2011-2022 走看看