Question

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

Was it helpful?

Solution

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.

OTHER TIPS

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

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

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

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!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top