Sorry for confusion !

My sample here was simplified. Actually I have much more logics inside
this #each. I'm using #splice method inside some conditional matches.

this.removeItems = function(item) {

    var _myArray = myArray.clone();

    _myArray.each( function(content, index) {
        ....
        if(content.regItem == item) { delete content;
myArray.splice(index,1); }
        ....
    });
}

If all .regItem's equal to item's, only then myArray should be empty.

On Jun 24, 12:21 am, "Frederick Polgardy" <[EMAIL PROTECTED]> wrote:
> You could always do it recursively. ;-)  If only JavaScript had tail
> recursion!
>
> function eraseArray(a) {
>   delete a[0];
>   if (a.length > 0)
>     eraseArray(a.slice(1));
>
> }
>
> -Fred
>
> On Mon, Jun 23, 2008 at 4:02 PM, T.J. Crowder <[EMAIL PROTECTED]>
> wrote:
>
>
>
> > > I've solved this issue following:
>
> > But....why?!  Just set the length to zero.  No need for all of the
> > cloning and splicing!
>
> --
> Science answers questions; philosophy questions answers.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" 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/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to