IE不兼容findIndex

var arr = [ {id: 1, name: 'java'}, {id: 2, name: 'c++'}, {id: 3, name: 'js'}, {id: 4, name: 'c#'} ] // ES6 chorome兼容 var domIndex = '2' var spliceIdex; arr.findIndex((item,index)=>{ if(domIndex == index){ return spliceIdex= index; } }); arr.slice(spliceIdex,1); // JSchorome ANDIE兼容 Array.prototype._find_ = function(cb){ for(var i=0; i< this.length; i++){ if(cb(this[i],i)){ return this[i]; } } } arr._find_(function (item, index){ if(domIndex == index){ return spliceIdex= index; } }) arr.slice(spliceIdex,1);

【IE不兼容findIndex】更多可参考 点击此处

    推荐阅读