Using semicolon in javascript

Possible duplicate:
Why JavaScript Should Begin With ";" ?

I looked through some JavaScript in new Microsoft templates and practiced the Silk project on codeplex, and I came across something that I had never seen before ...

What is the purpose of the semicolon before the self execute function containing the jQuery plugin?

; (function (mstats, $) { // blah blah blah... } (this.mstats = this.mstats || {}, jQuery)); 
+4
source share
2 answers

This is to avoid any potential problems if you combine / compress / reduce your javascript files into one.

+7
source

This is just a coding practice so that the last statement has a semicolon at the end and, as Darin said

0
source

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


All Articles