What syntax is for (var i = 0, item; item = a[i++];)
In the Re-Introduction to Javascript, the syntax
for (var i = 0, item; item = a[i++];)
is explained as the middle "item" being a conditional test for
truthtiness/falsiness. However, I had assumed the syntax to be (start;
condition test; control factor) with semi-colons between each segment.
Here, the syntax is unfamiliar to me in the form (start, condition test;
control factor;) with a comma in the middle and semicolon at the very end.
Is it equivalent to
for (var i = 0; item; item = a[i++])
?
If so, why write it using comma and semicolon at the end?
No comments:
Post a Comment