zoukankan      html  css  js  c++  java
  • 解决低版本chrome浏览器不支持es6 Array.find()

     if (!Array.prototype.find) {
      Array.prototype.find = function(predicate) {
        'use strict';
        if (this == null) {
          throw new TypeError('Array.prototype.find called on null or undefined');
        }
        if (typeof predicate !== 'function') {
          throw new TypeError('predicate must be a function');
        }
        var list = Object(this);
        var length = list.length >>> 0;
        var thisArg = arguments[1];
        var value;

        for (var i = 0; i < length; i++) {
          value = list[i];
          if (predicate.call(thisArg, value, i, list)) {
            return value;
          }
        }
        return undefined;
      };
  • 相关阅读:
    弹窗
    ajax
    Jquery元素选取、常用方法
    PDO
    session的使用
    投票练习题
    php 批量删除
    php 连接数据库的增删改查
    面向对象的加载类和设计模式
    面向对象三大特性
  • 原文地址:https://www.cnblogs.com/cxf520/p/6243109.html
Copyright © 2011-2022 走看看