Hi Gary,

Thanks for your comment. I were able to apply your suggestion within
the "next" method, but not with the "prev". Would you like to share
version of the methods?

Leonardo Braga
@LeonardoBraga


On Dec 13, 5:04 pm, Gary Katsevman <[email protected]> wrote:
> >        this.next = function() {
> >                (!(++this.position < this.array.length)) && (this.position = 
> > 0);
> >                return this.array[this.position];
> >        }
>
> Why not use modulo on the position and return
> this.array[this.position++ % this.array.length] for next and -- for
> prev?
>
> ------------------------
> Gary Katsevman
> Computer Science Undergraduate
> Northeastern University
> gkatsev.com

-- 
You received this message because you are subscribed to the Google Groups "The 
JSMentors JavaScript Discussion Group" 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/jsmentors?hl=en.

Reply via email to