javascript删除数组中的某个元素-----拓展Array 原型方法

Array.prototype.remove = function (dx)

{

    if(isNaN(dx) || dx > this.length)

   {

        return false;

   }

   var  n = 0;

   for(var i =0; i < this.length; i++)

  {

        if(this[i] ! = this[dx])

        {

             this[n++] = this[i];

        }

  }

  this.length  - = 1;

}

原文地址:https://www.cnblogs.com/yiliweichinasoft/p/3330312.html