zoukankan      html  css  js  c++  java
  • [javascript] 数组扩展操作

    /**
     *
     * 用来判断数组是否包含某个元素
     * @author niaoren 2011-12-27
     
    */
    Array.prototype.S = String.fromCharCode(2);
    Array.prototype.in_array = function(e)
    {
        var r=new RegExp(this.S+e+this.S);
        return (r.test(this.S+this.join(this.S)+this.S));
    }
    /**
     * 删除指定下标的元素
     *
     * @author niaoren 2012-02-28
     
    */
    Array.prototype.remove = function(index)
    {
        if (isNaN(index) || index > this.length) 
        {
            return false;
        }
        this.splice(index, 1);
    }
    /**
     * 数组克隆
     *
     * @author niaoren 2012-02-28
     
    */
    Array.prototype.clone = function()

        return this.slice(0); 
  • 相关阅读:
    python生成CSV文件并发送邮件
    Live2d Test Env
    Live2d Test Env
    Live2d Test Env
    Live2d Test Env
    Live2d Test Env
    Live2d Test Env
    Live2d Test Env
    Live2d Test Env
    扔鸡蛋
  • 原文地址:https://www.cnblogs.com/davidhhuan/p/2372039.html
Copyright © 2011-2022 走看看