0

我想缩短我的 JS,但编译时出现错误。

来自以下点的错误警告:

default = {
        Home:'',
        Max: 5,
}

或者

items: {
     visible: 1,
     width: 200
      }

华灵消息:

JSC_TRAILING_COMMA: Parse error. IE8 (and below) will parse trailing commas in array and object literals incorrectly. If you are targeting newer versions of JS, set the appropriate language_in option. at line 162 character 0
visible: 1,

JSC_TRAILING_COMMA: Parse error. IE8 (and below) will parse trailing commas in array and object literals incorrectly. If you are targeting newer versions of JS, set the appropriate language_in option. at line 249 character 0
Home:'',

告诉我如何解决这个错误。

4

2 回答 2

3
default = {
    Home:'',
    Max: 5,

}

需要是

default = {
    Home:'',
    Max: 5

}

于 2013-11-14T20:51:45.757 回答
0

您的选择是:

  1. ES3诊断组关闭为警告或关闭

  2. 将语言模式更改为ECMASCRIPT5ECMASCRIPT5_STRICT。EcmaScript 5 标准化尾随逗号行为,但如果您尝试运行未编译的代码,IE8 及更低版本将产生语法错误

  3. 更正代码以删除结尾的逗号。

于 2013-11-20T00:59:50.697 回答