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
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
This is an infinite loop.
The same as while(true)
.
I guess they use it instead of while
to make a file size smaller.
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.
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!