> I have an array of objects. I'd like to grab items from the array by specifying a range like 1-10, or 11-20, or 5-7, and so on..
> Seems trivial. How is this done with Prototype?
>
var arr = $w('the quick brown fox jumped over the lazy dog');
$R(1,5).each(function(n){
console.log(arr[n]);
});
//-> should output the words quick through over, one to a line, in your console.
I'm sure there's another way, but that's what I would do.
Walter
> --
> 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/-/hyCKraRuIykJ.
> To post to this group, send email to prototype-s...@googlegroups.com.
> To unsubscribe from this group, send email to prototype-scripta...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
$A($w('the quick brown fox jumped over the lazy dog').slice(1,5)).each(function(elm){console.log(elm);});
Walter
> --
> 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/-/e0tUAEIkO_4J.
Walter
> --
> 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/-/zOftjBzBA9EJ.
automagically