On Oct 9, 12:23 pm, "T.J. Crowder" <[EMAIL PROTECTED]> wrote:
> Or, if there's a situation where any() or all() doesn't suit, you can
> break each() loops by throwing $break.
Yes I can do it, but I cannot determine afterwards whether I've exited
iteration with throwing $break or I've iterated thru all elements.
Also scenatio of returning something different than true/false using
any() and all() is undoable with each():
function checkSomething (arr)
var succ = "Succ";
var fail = "Fail"
for (i=0 ; i < arr.length ; i++) {
var c = arr[i];
if (c == 15) return fail;
}
return succ;
}
You cannot re-do function above using each(). All I know you can do $
(arr).all(function (c) {...}) ? "Succ" : "Fail";.
--~--~---------~--~----~------------~-------~--~----~
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 [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
-~----------~----~----~----~------~----~------~--~---