站内搜索:
首页 >> 前端 >> 内容
nodelist不能使用foreach的问题解决办法

时间:2017/12/5 10:35:47

nodelist不能使用foreach的问题解决办法

if (window.NodeList && !NodeList.prototype.forEach) {
        NodeList.prototype.forEach = function (callback, thisArg) {
            thisArg = thisArg || window;
            for (let i = 0; i < this.length; i++) {
                callback.call(thisArg, this[i], i, this);
            }
        };
    }

  • 上一篇:git常用命令总结(建议收藏)
  • 下一篇:手动配置react环境教程
  • 返回顶部