forEach兼容ie8
阿新 • • 發佈:2018-06-14
UNC RR nts sar ie8 alt each ray call
if
( !Array.prototype.forEach ) {
Array.prototype.forEach =
function
forEach( callback, thisArg ) {
var
T, k;
if
(
this
==
null
) {
throw
new
TypeError(
"this is null or not defined"
);
}
var
O = Object(
this
);
var
len = O.length >>> 0;
if
(
typeof
callback !==
"function"
) {
throw
new
TypeError( callback +
" is not a function"
);
}
if
( arguments.length > 1 ) {
T = thisArg;
}
k = 0;
while
( k < len ) {
var
kValue;
if
( k
in
O ) {
kValue = O[ k ];
callback.call( T, kValue, k, O );
}
k++;
}
};
}
forEach兼容ie8