开发者

semicolon usage in javascript [duplicate]

This question already has answers here: Closed 11 years ago.

Possible Duplicate:

Why does the JavaScript need to start with “;” ?

I've been looking at some JavaScript in the new Microsoft patterns and practises project Silk on codeplex and I've come across something I've never seen before...

What is the the purpose of the semicolon before th开发者_运维百科e self executing function containing a jQuery plugin?

; (function (mstats, $) {
    // blah blah blah...
} (this.mstats = this.mstats || {}, jQuery));


It's to avoid any potential problems if you concatenate/compress/minify your javascript files into a single one.


This is just a coding practice to make sure that last statement had a semicolon at its end and as told by Darin

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜