[英]Semicolon on jQuery
The following jQuery works with or without a semicolon after the function. 以下jQuery在函数之后使用或不使用分号。 Why?
为什么?
jQuery(document).ready(function(){
jQuery("#red").treeview({
animated: "fast",
collapsed: true,
control: "#treecontrol",
persist: "cookie"
})
});
It works on all browsers. 它适用于所有浏览器。 Wouldn't this cause an error?
这不会导致错误吗?
JavaScript doesn't actually require semicolons. JavaScript实际上不需要分号。 That's just convention.
那只是惯例。
http://inimino.org/~inimino/blog/javascript_semicolons http://inimino.org/~inimino/blog/javascript_semicolons
I recommend using semicolons, just like I'd recommend indenting your code. 我建议使用分号,就像我建议缩进你的代码一样。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.