Array#remove支持移除NaN元素
This commit is contained in:
parent
bd903c9d14
commit
f56ab9d857
|
@ -9022,7 +9022,12 @@ new Promise(resolve=>{
|
||||||
writable:true,
|
writable:true,
|
||||||
value:function(){
|
value:function(){
|
||||||
for(const item of arguments){
|
for(const item of arguments){
|
||||||
const pos=this.indexOf(item);
|
let pos=-1;
|
||||||
|
if (typeof item=='number'&&isNaN(item)){
|
||||||
|
pos=this.findIndex(v=>isNaN(v))
|
||||||
|
}else{
|
||||||
|
pos=this.indexOf(item);
|
||||||
|
}
|
||||||
if(pos==-1) continue;
|
if(pos==-1) continue;
|
||||||
this.splice(pos,1);
|
this.splice(pos,1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue