繁体   English   中英

jQuery上的分号

[英]Semicolon on jQuery

以下jQuery在函数之后使用或不使用分号。 为什么?

jQuery(document).ready(function(){
jQuery("#red").treeview({
    animated: "fast",
    collapsed: true,
    control: "#treecontrol",
    persist: "cookie"
})

});

它适用于所有浏览器。 这不会导致错误吗?

JavaScript实际上不需要分号。 那只是惯例。

http://inimino.org/~inimino/blog/javascript_semicolons

我建议使用分号,就像我建议缩进你的代码一样。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM