Can someone tell me what double semicolons (;;) in javascript means? I see them in fullcalendar.js.
Thanks.
Here\'s a snippet of the fullcalendar.js code (ta
Empty “for” loop
for(;;){...}
is the same as saying while(1){...}
for(;;)
jumps out to mean "infinite loop" more readily than while(1)
facebook's AJAX responses
all start with an empty for loop.
The double semicolons ;;
has nothing to do with a for
loop in the case of fullcalendar.js
(which is now on github).
There is no value to the parsing or execution of the code itself (it is basically innocuous); rather the author has used ;;
merely as a sentinel to separate logical chunks of code. It was a weird and esoteric choice to do this, but as it turns out it is very helpful to use CTRL-F to search for ;;
to jump from one section to another (for example, the class definitions appear to be separated in this way).
The author could have used comments, for example:
/* ;; */
or
/* CLASSDEF */
etc., but he didn't.
Also confirmed: the JavaScript minifiers I tested remove the ;;
so definitely not critical to the code, and not helpful as a sentinel when searching minified code. (but neither are comments because they are stripped out).