3

When i read javascript file it has tow ";" sometimes,like:

(function($, undefined) {


;;

var defaults = {

    ..........

what that meaning?

Dolphin
  • 29,069
  • 61
  • 260
  • 539
  • It doesn't mean anything special. It's just an empty statement. – Barmar Dec 10 '13 at 02:44
  • 3
    It means the developer had too much coffee that morning. – Blue Skies Dec 10 '13 at 02:44
  • 1
    Empty statement: http://es5.github.io/#x12.3 – Felix Kling Dec 10 '13 at 02:45
  • Not actually an answer (because it's already been answered) but sometimes you'll see ;(function($, undefined) { ... and that is done on purpose to close other previously loaded files (possibly) bad javascript before yours. – Lenny Dec 10 '13 at 02:47
  • 1
    Sometimes it means breaking it down. See http://stackoverflow.com/questions/6955767/what-does-it-do-jquery-ui-function. – flypen Dec 10 '13 at 02:48

3 Answers3

6

That's just a null statement (known as an "empty statement" by the ECMAScript standard). This works as well:

;;;;;;;;;;;;;;;;;;;;;;;;;;alert('lots of semicolons');;;;;;;;;;;;;;;;;;;

It doesn't mean anything.

tckmn
  • 57,719
  • 27
  • 114
  • 156
1

It doesn't mean anything special. The second semicolon is just an empty statement and you could safely remove it if you wanted.

hugomg
  • 68,213
  • 24
  • 160
  • 246
1

It is probably a typo. It is not necessary.

Here is a link to semicolons in JavaScript that you might find helpful.

http://www.codecademy.com/blog/78-your-guide-to-semicolons-in-javascript

whoacowboy
  • 6,982
  • 6
  • 44
  • 78