Sorry the first example was incorrect:

Array.range(2); // returns [0,1]

--
Fábio Miranda Costa
Solucione Sistemas
Engenheiro de interfaces


On Wed, Mar 3, 2010 at 9:24 PM, Trevor Orr <[email protected]> wrote:

> I could see the being useful once in a while, think it might be a good
> addition to the more library.
>
>
>
>
> On Wed, Mar 3, 2010 at 4:19 PM, hazlema <[email protected]> wrote:
>
>> In my opinion, it would be really cool if mootools could use a range
>> operator for numeric sets:
>>
>> new Array.Range( [0, 10] );
>>
>> would create an array with 11 empty elements
>>
>> new Array.Range( [0, 10] , function() {
>>    return new Element('div');
>> });
>>
>> would create an array with 11 elements with div in each spot
>>
>> Consider this code segment:
>>
>> Days = new Array().Range( [0, 31], function(index) {
>>                    ele = new Element('div', {class: 'weekdays'});
>>                    if ((index % 7 == 0) || (index % 7 == 6))
>> ele.removeClass('weekdays').setClass('weekends');
>>                   return ele;
>>           });
>> You got it, its a calendar
>>
>> You could use it for existing arrays as well:
>>
>> DaysArray.Range( [9, 11], function(index) {
>>              this.Hide();
>> });
>>
>> Just a thought I had while I was building an app, what do you think?
>>
>
>

Reply via email to