zoukankan      html  css  js  c++  java
  • js获取数组,进行循环处理,添加,删除,查找等操作

    //js循环 添加
    that.workTypeActiveIds.forEach(function (value, key, iterable) { console.log(key, value, iterable); var work = that.workTypesItemAll.find(function (work) { return work.id === value }); that.WorkTypeActiveTtems.push(work); that.workTypes.push(work.text); });

    js查找索引和删除

     // 查询元素在数组中的索引值
            Array.prototype.indexValue = function (arr) {
                for (var i = 0; i < this.length; i++) {
                    if (this[i] == arr) {
                        return i;
                    }
                }
            }
            Array.prototype.remove = function (val) {
                var index = this.indexOf(val);
                if (index > -1) {
                    this.splice(index, 1);
                }
            };

    根据值进行查找

      var salary = that.salaryList.find(function (salary) {
                                    return salary.id === result.JobInfo.SalaryTypeId;
                                });
  • 相关阅读:
    HTML基础 整理
    今天课堂总结
    课后习题
    JAVA的文件创建
    JAVA_输入输出流 异常处理
    12.23流水账号
    12.22 repeater 删除
    12.22 repeater 修改
    12.22 repeater 添加
    12.22 repeater 主页
  • 原文地址:https://www.cnblogs.com/njccqx/p/13706630.html
Copyright © 2011-2022 走看看