Do you try to access the same variable in both functions?

If yes you could pass the "function A" array length to "function B" or bind it 
to "function B".


Cheers,

Ngoc
--

Blog: http://blog.nhdoan.de
Magento: http://demo.mage.nhdoan.de

Am 19.01.2011 um 14:31 schrieb Ran Berenfeld:

> Hello all
> 
> sorry for this stupid question, but all these talks about the "*this" pointer 
> and the variable
> scope in js got me confused.
> support I have 2 functions, one calling the other inside array iteration. can 
> they both
> use the same local variable for array index ?
> should I use a "var" statement ?
> 
> for example :
> 
> 
> function B()
> {
>    for(i=0;i<array_b_length;i++)
>    {
>        ...
>    }
> }
> 
> function A()
> {
>    for(i=0;i<array_a.length;i++)
>    {
>       B()
>       ...
>    }
> }
> 
> Thanks
> Ran
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Prototype & script.aculo.us" group.
> To post to this group, send email to prototype-scriptaculous@googlegroups.com.
> To unsubscribe from this group, send email to 
> prototype-scriptaculous+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/prototype-scriptaculous?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to