In other words, the 1st parameter of the loop declares and initialises a variable (fl) to 10. The loop then executes the 2nd parameter, which is a logical check. It basically says "if FL is less-than-or-equal-to 150". If this statement is a true statement, it will execute the body of the loop (sum = sum + fl) and will then proceed to the 3rd and final parameter of the loop, which is an increment.
This code can also be written as:
Code:
var sum = 0;
for (fl=10; fl<=150; fl+= 5)
{
sum += fl;
}
document.write (sum += fl);
This code doesn't really make much sense, but it may be part of a larger file that we can't see.
Bookmarks