Victor
unread,Aug 24, 2011, 3:55:41 AM8/24/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to prototype-s...@googlegroups.com
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');