草庐IT

javascript - 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我建议使用分