2

Hi i have question which means for (;;); in Facebook long polling request ? This statement is in every file which is long polled from Facebook server.

Thank you

4 Answers4

1

This is an infinite loop. The same as while(true).

I guess they use it instead of while to make a file size smaller.

Eugene Naydenov
  • 7,165
  • 2
  • 25
  • 43
1

in a for loop all params are optional, this is basically an infinite loop

MichaC
  • 13,104
  • 2
  • 44
  • 56
1

No way this infinite loop is executed; just try it in your console. A simple operation like integer incrementing will freeze your screen:


    var a = 1;
    for (;;) {
        a++;
    }

It may be just a small trap for anyone who tries to eval their script, or something.

tikider
  • 540
  • 3
  • 12
  • you're right, I believe I recall from when this came up before somewhere - this is intended as a security measure. – JAL Sep 24 '13 at 17:51
0

that's an infinite loop,

for(;;) {[condition to break + loop logic]}
while ([condition to break]) { }
do { } while ([condition to break]);

for example, you can use it to repeat certain operation multiple times and it's up to you to decide when to stop iterating using a break statement. (just a fancy way of using a for instead of a do/while)

cheers!

manchax
  • 31
  • 4