jQuery上的分号

Alx*_*ejo 6 javascript jquery

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

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

});
Run Code Online (Sandbox Code Playgroud)

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

Bra*_*rad 12

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

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

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