foo(str){
            var temp = str.split(/[\n,]/g);
                for(var i =0;i<temp.length;i++){
                if(temp[i] == ""){
                    temp.splice(i, 1);
                    //删除数组索引位置应保持不变
                    i--;
                }
            }
            return temp
       }

   foo(1,2,3); //['1','2','3']

  

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-31
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-21
  • 2021-11-29
  • 2022-12-23
  • 2021-11-10
  • 2022-12-23
相关资源
相似解决方案