使用数组的splice方法!
//假设我希望删去数组中'd'字母 let array = ["a","b","c","d","e"]; let index; let deleteElem = "d"; for(index=0; index<array.length; index++){ if(deleteElem === array[index]){ array.splice(index,1); } } console.log(array); //["a","b","c","e"]新闻热点
疑难解答