Advertisement
Cronokirby

CT RANKS script

Aug 24th, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. function SORT(a,b) {
  3.   if (a[1] < b[1]) { return -1}
  4.   else if (a[1] === b[1]) {return 0}
  5.   else return 1
  6. }
  7.  
  8.  
  9. function PROCESS(array){
  10.   array.sort(SORT)
  11.   for (i = 0; i <= array.length-1 ; i++){
  12.     //this first loop starts the next loop for every single value in the second column
  13.     var Name = String(array[i][0])
  14.     //this second loop eliminates all duplicate times, except the highest time for that author
  15.     for (j = array.length-1;j >= i+1 ; j--){
  16.       if (Name === String(array[j][0])){
  17.         array.splice(j,1)
  18.       }
  19.     }
  20.      
  21.   }
  22. return array
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement