i have some arrays like this, the numbers in the array represents  slots numbers
       slots1 = {3,4,5,6}
       slots2 = {1,2,3,4,5,6}
       slots3 = {8,9,10}
      i am finding whether the selected slots are successive or not.
   first two arrays give correct min,max values.
  but the third array is giving min = 10, max=9.
   how to rectify it? 
i am finding maximum value like this
for(var s=0;s<no_slots;s++)//finding maximum value of slots array
        {    
             if(s == 0)
             { 
              var slots_max = slots[s];
             }
             else
             {
                    if(slots[s] > slots_max)
                    {
                      slots_max = slots[s];
                    }
             }              
        }  
 
     
     
     
    