zoukankan      html  css  js  c++  java
  • js数组方法

    js数组基本方法

      1.join() 数组转换成字符串,参数为连接符,默认,
      2.push() pop() 数组末尾添加删除
      3.unshift() shift() 数组开始添加删除
      4.sort() 从小到大排序
      5.reverse() 反转数组顺序
      6.concat() 参数添加到原数组,返回新数组
      7.slice(a,b) a、b数组下标起始和结束位置(包含开头,不含结尾),若为负数,替换为Array.length+a/b
      8.splice(a,b,c)  数组删除,插入,替换 a:起始位置  b:删除长度 c:当前位置插入元素
      9.indexOf() lastIndexOf()  数组开头 末尾查索引
      10.forEach()  map()  数组遍历   forEach()无返回值  map()返回数组
      11.filter()  数组过滤
      12.some()  every()  some()数组中有一项满足条件返回true,every()数组中所有项满足条件返回true
      13.find()  找到数组中第一个符合条件的值
      14.includes() 是否包含
      15.reduce()/reduceRight() 方法接收一个函数作为累加器,数组中的每个值(从左到右)开始缩减,最终计算为一个值。
  • 相关阅读:
    canvas-8clip.html
    canvas-7globleCompositeOperation2.html
    canvas-7globleCompositeOperation.html
    canvas-7global.html
    canvas-6shadow.html
    canvas-6font.html
    A1036. Boys vs Girls
    A1006. Sign In and Sign Out
    A1011. World Cup Betting
    String 对象-->charAt() 方法
  • 原文地址:https://www.cnblogs.com/-swz/p/14178383.html
Copyright © 2011-2022 走看看