Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

javascript "for (;;);" structure [duplicate]

Tags:

javascript

Possible Duplicate:
Empty “for” loop in Facebook ajax
what does AJAX call response like for (;;); { json data } mean?

While analyzing some facebook ajax requests body i noticed that every code starts with for (;;);, folloed by an json object

something like

for (;;); {"a":1,"b":"\u003cdiv"}

I googled after this structure but found nothing.

What could be the reason for this "for" structure at the beginning of every ajax response?

like image 719
humeniuc Avatar asked Nov 14 '22 15:11

humeniuc


1 Answers

A for like this (note that there isn't the ';' after the bracket):

for (;;)

means an infinite loop where the statements executed are those between the brackets.

Instead, a for like this:

for (;;);

means an infinite loop with no statement.

like image 151
Aurelio De Rosa Avatar answered Jan 12 '23 01:01

Aurelio De Rosa