1

I was just going through the source code of cordova.js, its structure is like

;(function() { cordova code I have yet to understand })();

Just curious what does the first semi-colon imply?

Is it just to make sure that there is a semicolon preceding the anonymous function or does it mean something else?

4

2 回答 2

2

这是一个防御性分号,以防有人在您的代码之前连接一些 JavaScript,而这个连接的代码忘记放置一个终止分号。

于 2013-07-16T14:01:46.710 回答
0

只是为了防止合并多个js文件时出错。因此,您可以根据需要将其删除。

于 2013-07-16T14:01:34.077 回答