核心提示:nodelist不能使用foreach的问题解决办法if (window.NodeList!NodeList.prototype.forEach) {NodeList.prototype.forEac...
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); } }; }