标签: jslint
我的代码如下(也可在jsfiddle处获得):
$button = $('<button />', { text: 'my button', class: 'button' });
jslint错误消息是:
Problem at line 3 character 5: Expected an identifier and instead saw 'class' (a reserved word). class: 'button'
答案 0 :(得分:8)
Class is a reserved word for Javascript 2.0,因此您不应将其用作对象中的键而不将其放在引号之间以将其标记为字符串。