(Assuming I didn't mess it up badly), the while equivalent to the following:
var elt; do { v++; div.innerHTML = '' elt = div.getElementsByTagName('i')[0]; } (while elt);
mdc or any good ones cover this while (stmt1, stmt2) thing.
Here the MDC talks about while :
while (condition) statement
condition
An expression calculated before each passage through the loop. If this condition evaluates to true , statement is executed. When the condition evaluates to false , execution continues with the statement after the while .
We can know for sure that expression is in JavaScript from the MDC:
An expression is any valid set of literals, variables, operators, and expressions that is evaluated with a single value; the value can be a number, a string, or a boolean.
Conceptually, there are two types of expressions: those that assign a value to a variable, and those that just matter. For example, the expression x = 7 is an expression that assigns x to seven. This expression in itself is estimated to be seven. These expressions use assignment operators. On the other hand, the expression 3 + 4 simply evaluated to seven; he does not complete the task. The operators used in such expressions are simply called operators.
If you feel brave, you can also check the ECMA-262 language specification , in particular the following sections:
- 11 Expressions, especially 11.14 Comma Operator (
, ) - 12.6.2
while statement
Sorry, I canโt provide direct links, like everything inside a PDF.