我想缩短我的JS,但编译时会出现错误。
来自以下各点的错误警告:
default = {
Home:'',
Max: 5,
}
或
items: {
visible: 1,
width: 200
}
Waring Msg:
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:'',
说我如何解决这个错误。
答案 0 :(得分:3)
default = {
Home:'',
Max: 5,
}
需要
default = {
Home:'',
Max: 5
}
答案 1 :(得分:0)
您的选择是:
将ES3
诊断组关闭为警告或关闭
将语言模式更改为ECMASCRIPT5
或ECMASCRIPT5_STRICT
。 EcmaScript 5标准化尾随逗号行为,但如果您尝试运行未编译的代码,则IE8及更低版本将产生语法错误
更正代码以删除尾随逗号。