Merge pull request #692 from nonameShijian/PR-Branch

Array#remove支持移除NaN元素
This commit is contained in:
Spmario233 2023-12-01 23:17:20 +08:00 committed by GitHub
commit 290cf2ff7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -9022,7 +9022,12 @@ new Promise(resolve=>{
writable:true,
value:function(){
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;
this.splice(pos,1);
}