📌  相关文章
📜  javascript 从数组中删除垃圾元素 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:14.653000             🧑  作者: Mango

代码示例1
let myArray = ["user1","user2", "", ""]
console.log(myArray)

function cleanArray(_array) {
  for (i in _array){
    if(_array[i] == ''){
      _array.splice(i, 1)
    }
  }
  return _array
}

console.log(cleanArray(cleanArray(myArray)))