tags:

views:

332

answers:

5

I've seen a triple semicolon in a few expressions here and there.
Does it have any logical effect?

The Closest thing I've seen for an explanation is that it tells the Dean Edwards compressor to ignore that line.

;;; var someVar = 'Rebel';
+13  A: 

Nothing. Absolutely nothing.

Three semicolons, ten semicolons, a hundred semicolons, they all get interpreted to the same result: nothing.

Jacob Relkin
Let me be known as the guy who got you over 10K rep. :)
ChaosPandion
@Chaos, thanks dude!
Jacob Relkin
@Gert - I also measure time in nano seconds. :)
ChaosPandion
Guys, this is the age of quad-core processors. There really isn't much more time required to parse some more freakin' semicolons! Jeez.
Jacob Relkin
It's not exactly "nothing"...Multiple semicolons do just the same that one single semicolon, but using no semicolon at all and relying on "automatic semicolon insertion" by the interpreter is a BAD practice.In most cases a carriage return with no semicolon will just work, but in a few cases the results will be unexpected and erroneus.
Sebastián Grignoli
You say "compile", but Javascript is an interpreted language (natively). It does not get compiled at all. Although who knows what the future holds; the new [V8 engine](http://code.google.com/apis/v8/) actually does compile it to machine code.
Josh Stodola
@Josh - This assumes they are specifically talking about JavaScript in Mozilla Firefox. This question is implementation agnostic and many will compile the code. *(Take my implementation for example.)*
ChaosPandion
+1  A: 

They are empty statements and have no effect. It is possible that the interpreter or compiler will remove them unless a statement is required by the syntax.

ChaosPandion
+14  A: 

It makes people ask questions on StackOverflow.

Other than that, it does nothing.

Joey Adams
+4  A: 

Ends an empty statement 3 times.

+12  A: 

They can be used to format silly-looking code, for example:

;;  ;;  ;;;;;  ;;     ;;      ;;;;; 
;;  ;;  ;;     ;;     ;;     ;;   ;;
;;;;;;  ;;;;   ;;     ;;     ;;   ;;
;;  ;;  ;;     ;;     ;;     ;;   ;;
;;  ;;  ;;;;;  ;;;;;  ;;;;;   ;;;;; 
el.pescado
Lol! Did you draw that right now? :)
Daniel Vassallo