屏蔽js类库加载的时候某个属性

来源:互联网 发布:linux服务器占有率 编辑:程序博客网 时间:2024/06/05 08:40

如下代码所示,将屏蔽‘indexOf’

<script>if (!Array.prototype.indexOf) {    Array.prototype.indexOf = function(elt /*, from*/ ) {        var len = this.length >>> 0;        var from = Number(arguments[1]) || 0;        from = (from < 0) ? Math.ceil(from) : Math.floor(from);        if (from < 0)            from += len;        for (; from < len; from++) {            if (from in this &&                this[from] === elt)                return from;        }        return -1;    };}</script>
0 0