JQuery semicolon

The following jQuery works with or without a semicolon after a function. Why?

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

It works in all browsers. Could this be the cause of the error?

+6
source share
1 answer

JavaScript does not actually require semicolons. This is just an agreement.

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

I recommend using semicolons, just as I would recommend padding from your code.

+10
source

Source: https://habr.com/ru/post/915815/


All Articles