On Mon, 25 Jun 2007 18:03:40 +0200, Lachlan Hunt
<[EMAIL PROTECTED]> wrote:
Philip Taylor wrote:
I'd also remove the "var rows = null;" and put the "var" inside the
loop to simplify the code, though perhaps that's a bad idea because JS
scoping is weird.
Correct me if I'm wrong, but if it were declared inside the loop, the
variable would be destroyed and reallocated in memory for every loop. By
declaring it outside, it just allocates it once, which is more efficient.
Javascript doesn't have scope more fine-grained than function. You could
even declare the variable after the loop and it would run just the same.
For readability (indicating the variable is only intended to be used
inside the loop), var-ing it inside the loop would probably be best. Not
all that much point in optimizing an example just intended to show the
select* methods are superior, though.
--
Magnus Kristiansen
"Don't worry; the Universe IS out to get you."