For Enumeration (Hash, ObjectRange etc.) use Enumeration#each

var index = -1;
enumeration.each(function(e, i) {
  if (e === 'bar') {
    index = i;
    // looking for the first occurrence
    throw $break;
  }
});

for Array you can use shorter

var index = ['foo','bar','baz'].indexOf('bar');


-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/prototype-scriptaculous/-/qbzq067-augJ.
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/prototype-scriptaculous?hl=en.

Reply via email to