循环删除数组指定下标的元素

for(let i=0;i<selectedGroup.children.length;i++){
      let group = selectedGroup.children[i];                   
      delete shapeList[group.myShapeIndex];//删除指定下标元素,不改变shapeList长度                 
 }     
shapeList = shapeList.filter(Boolean);//清除数组中的空元素

 

posted @ 2023-02-24 13:18  怪咖咖  阅读(73)  评论(0编辑  收藏  举报