gpt4 book ai didi

javascript - 尾随逗号问题,javascript

转载 作者:数据小太阳 更新时间:2023-10-29 04:24:34 25 4
gpt4 key购买 nike

我目前正在努力让我的 jQuery 在 IE7 中工作,当我检查以下内容时:

$(".regflow").validate({
errorLabelContainer: $("#error-message"),
rules: {
txtTextOnly: {required: true,textOnly: true},
txtNumbersOnly: {required: true,numbersOnly: true},
txtPhoneOnly: {required: true,phoneOnly: true},
txtAreaCodeOnly: {required: true,numbersOnly: true},
txtSimCodeOnly: {required: true,simCodeOnly: true},
txtCprOnly1: {required: true,numbersOnly: true},
txtCprOnly2: {required: true,cprOnly1: true},
txtMailOnly: {required: true,mailOnly: true}
},

messages: {
txtTextOnly: {required: "Dette felt skal udfyldes"},
txtNumbersOnly: {required: "Dette felt skal udfyldes"},
txtPhoneOnly: {required: "Dette felt skal udfyldes"},
txtAreaCodeOnly: {required: "Dette felt skal udfyldes"},
txtSimCodeOnly: {required: "Dette felt skal udfyldes"},
txtCprOnly1: {required: "Dette felt skal udfyldes"},
txtCprOnly2: {required: "Dette felt skal udfyldes"},
txtMailOnly: {required: "Dette felt skal udfyldes"}
},
});

...我从 Lint 收到此错误:“警告:尾随逗号在 ECMA-262 对象初始值设定项中不合法”

有谁知道这是什么意思,我该如何解决?

最佳答案

删除尾随的逗号 - 以下部分末尾的逗号:

 messages: {
txtTextOnly: {required: "Dette felt skal udfyldes"},
txtNumbersOnly: {required: "Dette felt skal udfyldes"},
txtPhoneOnly: {required: "Dette felt skal udfyldes"},
txtAreaCodeOnly: {required: "Dette felt skal udfyldes"},
txtSimCodeOnly: {required: "Dette felt skal udfyldes"},
txtCprOnly1: {required: "Dette felt skal udfyldes"},
txtCprOnly2: {required: "Dette felt skal udfyldes"},
txtMailOnly: {required: "Dette felt skal udfyldes"}
},

在创建对象 {} 或数组 [] 时,您可以使用逗号分隔各个元素。但是这里在最后一项之后有一个额外的逗号,例如 [a, b, c,] - 根据 ECMA-262,这是不允许的。

关于javascript - 尾随逗号问题,javascript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1819821/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com