[Proto-Scripty] Re: find next element in an array?

2011-02-01 Thread Marc
The function you pass to each has a second optional index param: $$('.foo').each(function(elem, index) { elem.update('I am element ' + index); }); It's not all that clear in the docs but it's mentioned for the iterator param here: http://api.prototypejs.org/language/Enumerable/prototype/each/

[Proto-Scripty] Re: find next element in an array?

2011-02-01 Thread T.J. Crowder
Hi, I could swear there used to be an operator that worked over an   enumerable and maintained an index element as you went... As Marc's pointed out that `each` does have the index as the second parameter. But using `each` for this introduces unnecessary function creation, function calls, and

Re: [Proto-Scripty] Re: find next element in an array?

2011-02-01 Thread Bertilo Wennergren
On Tue, Feb 1, 2011 at 12:35, T.J. Crowder t...@crowdersoftware.com wrote: (now that `$break` has been deprecated). $break has been deprecated? Where is that documented? What are we supposed to use instead? -- Bertilo Wennergren berti...@gmail.com http://bertilow.com -- You received this

Re: [Proto-Scripty] Re: find next element in an array?

2011-02-01 Thread Walter Lee Davis
Yes, exactly! I knew it was in there somewhere, but I couldn't find the ref. Walter On Feb 1, 2011, at 3:37 AM, Marc wrote: The function you pass to each has a second optional index param: $$('.foo').each(function(elem, index) { elem.update('I am element ' + index); }); It's not all that

[Proto-Scripty] Re: Two Dimensional Arrays in class

2011-02-01 Thread ColinFine
It's curiously that not declare two dimensional array in prototype. It's nothing to do with Prototype. Javascript (like many scripting languages) doesn't have two-dimensional arrays. You can simulate them with arrays of arrays, but an initialiser has to be specific: if you are going to want a

[Proto-Scripty] Re: find next element in an array?

2011-02-01 Thread T.J. Crowder
Hi, $break has been deprecated? Yup. Where is that documented? I don't know, I only know because Tobie mentioned it to me once. I'm sure it's mentioned in a thread here somewhere. You'll note it's disappeared from the documentation. ECMAScript 5th edition's `forEach` (which is pretty much