Hi,
I am porting my code from prototype to MK and also try to apply FP as
much as I can. But, I'm a bit stuck... Is there a way to access some
index/loop variable in a forEach?
This is the code I want to change:
>> togglers = getElementsByTagAndClassName('a', 'toggler') //a's where I click
>> on
>> stretchers = getElementsByTagAndClassName('div', 'stretcher') //div's that
>> need toggling
>> for (var i=0; i<togglers.length; i++ ) { togglers[i].stretcher =
>> stretchers[i] }
...
When I change the for loop into a forEach, I loose the loop i variable
which I need to access the other variable elements.
>> forEach(togglers, function(e) { e.stretcher = stretchers[i] } )
Or is there an other function/way to do this in Mochi?
Thanks, Bart
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"MochiKit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/mochikit
-~----------~----~----~----~------~----~------~--~---