View Single Post
  #3 (permalink)  
Old December 1st, 2006, 03:17 PM
jlh42581 jlh42581 is offline
Registered User
 
Join Date: Dec 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

in javascript/perl/php slight difference in declaration of variables but i will do it in js. Per suggested previously.

var lowest_num=0;
for(var i=0;i<array_name.length;i++){
 if(array_name.length != i){ // no need to look at last
  var temp_holder = array_name[i];
  var temp_holder2 = arrau_name[i+1] // look one ahead
  if(temp_holder < temp_holder2){
    lowest_num=temp_holder;
  }
  else{
   lowest_num=temp_holder2;
  }
 }
}

should be fairly close, if not working

now if you wanna build a numerically sorted array, i suggest you look at "push / pop" method

Reply With Quote