While this JS code does work, it is horribly confusing for most readers.  I would create a separate `var i;` statement.