Asp.net mvc 4 在minify bundles Asp.Net上覆盖javascript保留字

Asp.net mvc 4 在minify bundles Asp.Net上覆盖javascript保留字,asp.net-mvc-4,bundle,minify,Asp.net Mvc 4,Bundle,Minify,我有以下javascript代码: Array.prototype.any = function (test) { if (!arguments.length) return !!this.length; var arguments = Array.prototype.slice.call(arguments, 1); var functionTest = typeof test == "function" ? test : function (x) {

我有以下javascript代码:

Array.prototype.any = function (test) {
    if (!arguments.length)
        return !!this.length;

    var arguments = Array.prototype.slice.call(arguments, 1);
    var functionTest = typeof test == "function" ? test : function (x) {return x == test;};

    for (var i = 0, len = this.length; i < len; i++)
        if (functionTest.apply(this[i], [this[i]].concat(arguments)))
            return true;

    return false;
};
Array.prototype.any=函数(测试){
if(!arguments.length)
return!!this.length;
var arguments=Array.prototype.slice.call(参数,1);
var functionTest=typeof test==“函数”?测试:函数(x){return x==test;};
for(var i=0,len=this.length;i
当我使用Asp.net bundle缩小JS文件时,保留字“arguments”变成一个字符变量,就像字母“I”,但是我需要变量参数,因为它存储了函数的参数

缩小后,您可以看到以下内容:

Array.prototype.any=function(n){var i,r,t,u;if(!i.length)return!!this.length;for(i=Array.prototype.slice.call(i,1),r=typeof n=="function"?n:function(t){return t==n},t=0,u=this.length;t<u;t++)if(r.apply(this[t],[this[t]].concat(i)))return!0;return!1}

Array.prototype.any=function(n){var i,r,t,u;if(!i.length)return!!this.length;for(i=Array.prototype.slice.call(i,1),r=typeof n==“function”?n:function(t){return t==n},t=0,u=this.length;t我认为给参数赋值不是个好主意:)


删除
var arguments=Array.prototype.slice.call(参数,1);
并将其替换为
var args=Array.prototype.slice.call(参数,1)

谢谢,它解决了我的问题。我不知道,但是当我使用像变量一样的保留字名称时,minifier也会识别像局部变量一样的保留字,并覆盖上下文中的所有保留字,从而导致错误。