乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      JScript Array對象的幾個原型方法...

       nbtymm 2007-01-31

      Array.prototype.inArray = function (value) {
      for (var i = 0; i < this.length; i++) {
      if (this[i] === value) {
      return true;
      }
      }
      return false;
      };

      Array.prototype.max = function(){
      for (var i = 1, max = this[0]; i < this.length; i++){
      if (max < this[i]) {
      max = this[i];
      }
      return max;
      };

      Array.prototype.min = function(){
      for (var i = 1, min = this[0]; i < this.length; i++){
      if (min > this[i]) {
      min = this[i];
      }
      return min;
      };

      Array.prototype.indexOf = function(p_var)
      {
      for (var i=0; i<this.length; i++)
      {
      if (this[i] == p_var)
      {
      return(i);
      }
      }
      return(-1);
      }

      Array.prototype.exists = function(p_var) {return(this.indexOf(p_var) != -1);}

      Array.prototype.queue = function(p_var) {this.push(p_var)}

      Array.prototype.dequeue = function() {return(this.shift());}

      Array.prototype.removeAt = function(p_iIndex) {return this.splice(p_iIndex, 1);}

      Array.prototype.remove = function(o)
      {
      var i = this.indexOf(o);
      if (i>-1)
      {
      this.splice(i,1);
      }
      return (i>-1);
      }

      Array.prototype.clear = function()
      {
      var iLength = this.length;
      for (var i=0; i < iLength; i++)
      {
      this.shift();
      }
      }

      Array.prototype.addArray = function(p_a)
      {
      if (p_a)
      {
      for (var i=0; i < p_a.length; i++)
      {
      this.push(p_a[i]);
      }
      }
      }

      Array.prototype.Unique = function()
      {
      var a = {}; for(var i=0; i<this.length; i++)
      {
      if(typeof a[this[i]] == "undefined")
      a[this[i]] = 1;
      }
      this.length = 0;
      for(var i in a)
      this[this.length] = i;
      return this;
      };

      Array.prototype.indexOf = function(obj, fromIndex)
      {
      if (fromIndex == null)
      {
      fromIndex = 0;
      }
      else if (fromIndex < 0)
      {
      fromIndex = Math.max(0, this.length + fromIndex);
      }

      for (var i = fromIndex; i < this.length; i++)
      {
      if (this[i] === obj)
      {
      return i;
      }
      }

      return-1;
      };

      Array.prototype.lastIndexOf = function(obj, fromIndex)
      {
      if (fromIndex == null)
      {
      fromIndex = this.length - 1;
      }
      else if (fromIndex < 0)
      {
      fromIndex=Math.max(0, this.length+fromIndex);
      }

      for (var i = fromIndex; i >= 0; i--)
      {
      if (this[i] === obj)
      {
      return i;
      }
      }

      return -1;
      };

      Array.prototype.insertAt = function(o, i)
      {
      this.splice(i, 0, o);
      };

      Array.prototype.insertBefore = function(o, o2)
      {
      var i = this.indexOf(o2);

      if (i == -1)
      {
      this.push(o);
      }
      else
      {
      this.splice(i, 0, o);
      }
      };

      Array.prototype.remove = function(o)
      {
      var i = this.indexOf(o);

      if (i != -1)
      {
      this.splice(i, 1);
      }
      };

      Array.prototype.mm=function()
      {
      var a={}, m=0, n="";
      for(var i=0; i<this.length; i++)
      a[this[i]]?++a[this[i]]:a[this[i]]=1;
      for(i in a){m=Math.max(m, a[i]); if(m==a[i]) n=i;}
      return {"variable": n, "times": m};
      }

        本站是提供個人知識管理的網(wǎng)絡存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
        轉(zhuǎn)藏 分享 獻花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多